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 organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\n City text, -- example: ['Washington', 'City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\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_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['USA', 'Coun', 'CAM']\n Province text, -- example: ['Washington', '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 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 geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['USA', 'Coun', 'I']\n Province text, -- example: ['Washington', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, 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 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 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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', '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 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 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 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 PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\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 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: ['Washington', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Washington', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Washington', '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: ['Washington', '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: ['USA', 'Coun', 'SUD']\n Province text, -- example: ['Washington', '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 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: ['Washington', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, 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 Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\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 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 lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\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 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 islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\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:\npercentage can be computed by [count(City = 'Washington') / count(all cities)] * 100%\nAmong the organizations where headquarters are in the 'USA', what is the percentage of the them are in 'Washington'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.City = 'Washington' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.City) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T2.Country = 'USA'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.City = 'Washington' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.City) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T2.Country = 'USA'", "index": 4000, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 City text, -- example: ['Washington', 'City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Established date, -- example: ['Established', '1974-02-18']\n PRIMARY KEY (Abbreviation)\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_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['USA', 'Coun', 'CAM']\n Province text, -- example: ['Washington', '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 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 geo_mountain (\n Mountain text, -- example: ['Mountain', 'Gran Sasso']\n Country text, -- example: ['USA', 'Coun', 'I']\n Province text, -- example: ['Washington', 'Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, 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 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 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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', '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 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 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 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 PRIMARY KEY (Name)\n);\n\nCREATE TABLE mountain (\n Name text,\n Mountains text,\n PRIMARY KEY (Name)\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 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: ['Washington', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, Country, Province)\n);\n\nCREATE TABLE city (\n Name text, -- example: ['Washington', 'Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Washington', '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: ['Washington', '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: ['USA', 'Coun', 'SUD']\n Province text, -- example: ['Washington', '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 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: ['Washington', 'Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, 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 Longitude real, -- example: [20.0, 14.4]\n Latitude real, -- example: [60.1, 38.6]\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 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 lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Altitude real, -- example: [533.0, 668.0]\n Type text, -- example: ['artificial', 'salt']\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 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 islandIn (\n Island text, -- example: ['Island', 'Svalbard']\n Lake text, -- example: ['Lake', 'Ozero Baikal']\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:\npercentage can be computed by [count(City = 'Washington') / count(all cities)] * 100%\nAmong the organizations where headquarters are in the 'USA', what is the percentage of the them are in 'Washington'?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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: ['MEX', 'USA', '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: ['MEX', '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 geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['MEX', 'USA', '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 mountain (\n Name text,\n Mountains text,\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 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 country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['MEX', 'USA', '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: ['USA', '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: ['MEX', '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 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 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 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 encompasses (\n Country text, -- example: ['MEX', '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 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 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_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['MEX', 'USA', '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 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 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 economy (\n Country text, -- example: ['MEX', '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 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 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 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 organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\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: ['MEX', 'A', 'AFG']\n Country2 text, -- example: ['MEX', 'USA', '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:\nWhat is the border length between 'USA' and 'MEX'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Length FROM borders WHERE Country1 = 'MEX' AND Country2 = 'USA'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Length FROM borders WHERE Country1 = 'MEX' AND Country2 = 'USA'", "index": 4001, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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: ['MEX', 'USA', '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: ['MEX', '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 geo_lake (\n Lake text, -- example: ['Lake', 'Barrage de Mbakaou']\n Country text, -- example: ['MEX', 'USA', '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 mountain (\n Name text,\n Mountains text,\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 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 country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['MEX', 'USA', '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: ['USA', '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: ['MEX', '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 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 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 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 encompasses (\n Country text, -- example: ['MEX', '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 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 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_desert (\n Desert text, -- example: ['Desert', 'Rub Al Chali']\n Country text, -- example: ['MEX', 'USA', '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 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 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 economy (\n Country text, -- example: ['MEX', '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 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 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 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 organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\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: ['MEX', 'A', 'AFG']\n Country2 text, -- example: ['MEX', 'USA', '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:\nWhat is the border length between 'USA' and 'MEX'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Alaska', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n CapProv text, -- capital province, example: ['Alaska', '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 geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Alaska', '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 mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\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 geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Alaska', '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 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 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: ['Province', 'Alaska', '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 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 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 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 city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Alaska', '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 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 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 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 Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\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 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 `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: ['Province', 'Alaska', '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 Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\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: ['Province', '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 PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlaska is a province\nList all the name and height of all mountains in Alaska\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 WHERE T2.Province = 'Alaska'", "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 WHERE T2.Province = 'Alaska'", "index": 4002, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Alaska', 'AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n CapProv text, -- capital province, example: ['Alaska', '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 geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Province', 'Alaska', '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 mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude real,\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE located (\n Province text, -- example: ['Province', 'Albania']\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 geo_river (\n River text, -- example: ['River', 'Bahr el-Djebel/Albert-Nil']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Province', 'Alaska', '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 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 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: ['Province', 'Alaska', '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 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 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 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 city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Province text, -- example: ['Alaska', '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 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 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 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 Latitude real, -- example: [60.1, 38.6]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE river (\n Name text, -- example: ['Aare', 'Adda']\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 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 `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: ['Province', 'Alaska', '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 Province text, -- example: ['Vienna', 'Afghanistan']\n Population integer, -- example: [8023244, 22664136]\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: ['Province', '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 PRIMARY KEY (Name)\n);\n\nCREATE TABLE islandIn (\n Island text, -- example: ['Island', 'Svalbard']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlaska is a province\nList all the name and height of all mountains in Alaska\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n PRIMARY KEY (Country)\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 continent (\n Name text, -- example: ['America', 'Africa']\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 province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, 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 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 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 encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['America', '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 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: ['S', '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: ['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: ['S', '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: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, 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 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 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 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 EstuaryLongitude real, -- example: [8.22, 9.88]\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 `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: ['United States', 'Afghanistan', 'Albania']\n Code text, -- example: ['S', '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 religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhen did the United States of America attained it's 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 T1.Independence FROM politics AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'United States'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Independence FROM politics AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'United States'", "index": 4003, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['S', 'Coun', 'I']\n Province text, -- example: ['Abruzzo', 'Afghanistan']\n PRIMARY KEY (Mountain, Country, Province)\n);\n\nCREATE TABLE economy (\n Country text, -- example: ['S', 'A', 'AFG']\n PRIMARY KEY (Country)\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 continent (\n Name text, -- example: ['America', 'Africa']\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 province (\n Name text, -- example: ['AG', 'AI']\n Country text, -- example: ['CH', 'SUD']\n PRIMARY KEY (Name, 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 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 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 encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['America', '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 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: ['S', '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: ['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: ['S', '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: ['Independence', 'Aachen', 'Aalborg']\n Country text, -- example: ['S', 'D', 'DK']\n Province text, -- example: ['Nordrhein Westfalen', 'Denmark']\n PRIMARY KEY (Name, 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 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 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 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 EstuaryLongitude real, -- example: [8.22, 9.88]\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 `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: ['United States', 'Afghanistan', 'Albania']\n Code text, -- example: ['S', '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 religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['United', 'African Methodist Episcopal', 'Anglican']\n PRIMARY KEY (Country, Name)\n);\n\nCREATE TABLE islandIn (\n Sea text, -- example: ['Sea', 'Norwegian Sea']\n);\n\nCREATE TABLE target (\n Country text, -- example: ['A', 'AFG']\n PRIMARY KEY (Country)\n);\n\nCREATE TABLE located (\n Country text, -- example: ['Coun', 'AL']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhen did the United States of America attained it's 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 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: ['Saudi Arabia', '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 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 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 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 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_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 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 country (\n Name text, -- example: ['Saudi Arabia', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Saudi Arabia', '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 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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', '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 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_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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\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);\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 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: ['Saudi Arabia', '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 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 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: ['Saudi Arabia', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, 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 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: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Saudi Arabia', '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 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 province (\n Name text, -- example: ['Saudi Arabia', '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: ['Saudi Arabia', 'Aali an Nil', 'Aberconwy and Colwyn']\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:\nSaudi Arabia is a country\nWhat is the name of the most recently founded organization in Saudi Arabia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Saudi Arabia' ORDER BY T1.Established DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name FROM organization AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Saudi Arabia' ORDER BY T1.Established DESC LIMIT 1", "index": 4004, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['Saudi Arabia', '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 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 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 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 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_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 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 country (\n Name text, -- example: ['Saudi Arabia', 'Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Saudi Arabia', '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 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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['Organization', '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 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_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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\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);\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 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: ['Saudi Arabia', '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 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 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: ['Saudi Arabia', 'Abu Dhabi', 'Afghanistan']\n PRIMARY KEY (Desert, 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 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: ['Name', 'ASEAN-Mekong Basin Development Group', 'African Development Bank']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Saudi Arabia', '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 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 province (\n Name text, -- example: ['Saudi Arabia', '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: ['Saudi Arabia', 'Aali an Nil', 'Aberconwy and Colwyn']\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:\nSaudi Arabia is a country\nWhat is the name of the most recently founded organization in Saudi Arabia?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Latitude real, -- example: [33.0, -24.5]\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_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 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 Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\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 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 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 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 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 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 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 SourceLongitude real, -- example: [8.2, 10.3]\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 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 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 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 islandIn (\n Island text, -- example: ['Island', 'Svalbard']\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 religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\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 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 Type text,\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 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_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 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 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);\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 5th highest infant mortality rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.Name FROM population AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code ORDER BY T1.Infant_Mortality DESC LIMIT 4, 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Name FROM population AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code ORDER BY T1.Infant_Mortality DESC LIMIT 4, 1", "index": 4005, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Latitude real, -- example: [33.0, -24.5]\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_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 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 Agriculture real, -- example: [2.0, 65.0]\n Industry real, -- example: [64.0, 20.0]\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 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 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 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 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 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 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 SourceLongitude real, -- example: [8.2, 10.3]\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 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 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 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 islandIn (\n Island text, -- example: ['Island', 'Svalbard']\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 religion (\n Country text, -- example: ['BERM', 'AUS']\n Name text, -- example: ['African Methodist Episcopal', 'Anglican']\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 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 Type text,\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 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_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 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 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);\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 5th highest infant mortality 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 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 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 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_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 Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\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 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 `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 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 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 encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\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 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: ['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 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 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 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 Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\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 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 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_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 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 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);\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: ['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 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 river has the 17th-longest length overall? Specify it's 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 Name, Length FROM river ORDER BY Length DESC LIMIT 16, 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name, Length FROM river ORDER BY Length DESC LIMIT 16, 1", "index": 4006, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 Population integer, -- example: [8023244, 22664136]\n PRIMARY KEY (Code)\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 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 `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 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 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 encompasses (\n Country text, -- example: ['S', 'A', 'AFG']\n Continent text, -- example: ['Europe', 'Asia']\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 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: ['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 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 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 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 Lake text, -- example: ['Lake', 'Ozero Baikal']\n River text, -- example: ['River']\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 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 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_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 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 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);\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: ['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 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 river has the 17th-longest length overall? Specify it's 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_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: ['S', '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: ['Zaire', 'Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Zaire', '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 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 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 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 Latitude real,\n PRIMARY KEY (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 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 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 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 province (\n Name text, -- example: ['Zaire', '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 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: ['Zaire', '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 Latitude real, -- example: [33.0, -24.5]\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 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 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: ['Zaire', '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 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_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Zaire', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, 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 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: ['Zaire', 'River', 'Bahr el-Djebel/Albert-Nil']\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 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 PRIMARY KEY (Abbreviation)\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 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: ['Zaire', '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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich Zaire region is home to the country's deepest lake's Name it and list its 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 T3.Name, T1.Name, T1.Depth 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 country AS T4 ON T4.Code = T3.Country WHERE T4.Name = 'Zaire'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Name, T1.Name, T1.Depth 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 country AS T4 ON T4.Code = T3.Country WHERE T4.Name = 'Zaire'", "index": 4007, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['D', 'DK']\n Province text, -- example: ['Zaire', 'Nordrhein Westfalen', 'Denmark']\n Longitude real, -- example: [10.0, 10.1]\n PRIMARY KEY (Name, Province)\n);\n\nCREATE TABLE country (\n Name text, -- example: ['Zaire', '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 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 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 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 Latitude real,\n PRIMARY KEY (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 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 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 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 province (\n Name text, -- example: ['Zaire', '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 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: ['Zaire', '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 Latitude real, -- example: [33.0, -24.5]\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 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 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: ['Zaire', '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 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_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Zaire', 'Abruzzo', 'Abu Dhabi']\n PRIMARY KEY (Sea, 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 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: ['Zaire', 'River', 'Bahr el-Djebel/Albert-Nil']\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 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 PRIMARY KEY (Abbreviation)\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 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: ['Zaire', '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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich Zaire region is home to the country's deepest lake's Name it and list its 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 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 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 PRIMARY KEY (Country)\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 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 continent (\n Name text, -- example: ['Africa', 'America']\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 mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Madagaskar', 'Island']\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 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 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_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 Island text, -- example: ['Madagaskar', '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 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: ['Madagaskar', '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 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 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: ['Madagaskar', '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 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 located (\n Province text, -- example: ['Province', 'Albania']\n Lake text, -- example: ['Lake', 'Lake Skutari']\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 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 river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\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 `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 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_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 desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe elevation of the summit refers to height\nWhat is the maximal elevation of the summit of the shortest mountain that can be found in the island of Madagaskar? Indicate what type of mountain it is.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Height, T3.Type FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T1.Name = 'Madagaskar' ORDER BY T3.Height DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Height, T3.Type FROM island AS T1 INNER JOIN mountainOnIsland AS T2 ON T1.Name = T2.Island INNER JOIN mountain AS T3 ON T3.Name = T2.Mountain WHERE T1.Name = 'Madagaskar' ORDER BY T3.Height DESC LIMIT 1", "index": 4008, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (Country)\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 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 continent (\n Name text, -- example: ['Africa', 'America']\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 mountainOnIsland (\n Mountain text, -- example: ['Mountain', 'Andringitra', 'Asahi-Dake']\n Island text, -- example: ['Madagaskar', 'Island']\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 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 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_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 Island text, -- example: ['Madagaskar', '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 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: ['Madagaskar', '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 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 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: ['Madagaskar', '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 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 located (\n Province text, -- example: ['Province', 'Albania']\n Lake text, -- example: ['Lake', 'Lake Skutari']\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 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 river (\n Name text, -- example: ['Aare', 'Adda']\n Lake text, -- example: ['Brienzersee', 'Lago di Como']\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 `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 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_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 desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe elevation of the summit refers to height\nWhat is the maximal elevation of the summit of the shortest mountain that can be found in the island of Madagaskar? Indicate what type of mountain it is.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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_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 politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\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 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 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 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 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 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 PRIMARY KEY (Country)\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 PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\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 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 PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\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 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 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 island (\n Name text, -- example: ['Aland', 'Alicudi']\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 PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Longitude real, -- example: [11.6, 12.1]\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:\nGDP refers to gross domestic product; Nation and country are synonyms\nWhich nation, with a population ranging from 60,000,000 to 99,000,000, has the greatest gross domestic product?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.GDP FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population BETWEEN 60000000 AND 90000000 ORDER BY T2.GDP DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Name, T2.GDP FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Population BETWEEN 60000000 AND 90000000 ORDER BY T2.GDP DESC LIMIT 1", "index": 4009, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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_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 politics (\n Country text, -- example: ['A', 'AFG']\n Dependent text, -- example: ['Depe', 'USA']\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 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 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 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 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 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 PRIMARY KEY (Country)\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 PRIMARY KEY (Name, Country)\n);\n\nCREATE TABLE population (\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 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 PRIMARY KEY (Name)\n);\n\nCREATE TABLE desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\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 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 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 island (\n Name text, -- example: ['Aland', 'Alicudi']\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 PRIMARY KEY (Abbreviation)\n);\n\nCREATE TABLE lake (\n Name text, -- example: ['Ammersee', 'Arresoe']\n Area real, -- example: [46.6, 40.2]\n Longitude real, -- example: [11.6, 12.1]\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:\nGDP refers to gross domestic product; Nation and country are synonyms\nWhich nation, with a population ranging from 60,000,000 to 99,000,000, has the greatest gross domestic product?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 Lake text, -- example: ['Lake', 'Ozero Baikal']\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 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 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 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 PRIMARY KEY (Country)\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 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 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 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 mountain (\n Name text,\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 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_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 Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\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 SourceLongitude real, -- example: [8.2, 10.3]\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 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 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 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 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 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 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:\nGross domestic product = GDP; Largest share of GDP in agricultural sector was mentioned in economy.Agriculture\nWhich Asian country gave its agricultural sector the largest share of its gross domestic product?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Asia' ORDER BY T4.Agriculture DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Country FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Asia' ORDER BY T4.Agriculture DESC LIMIT 1", "index": 4010, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 Lake text, -- example: ['Lake', 'Ozero Baikal']\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 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 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 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 PRIMARY KEY (Country)\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 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 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 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 mountain (\n Name text,\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 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_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 Type text, -- example: ['volcanic', 'lime']\n Longitude real, -- example: [20.0, 14.4]\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 SourceLongitude real, -- example: [8.2, 10.3]\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 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 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 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 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 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 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:\nGross domestic product = GDP; Largest share of GDP in agricultural sector was mentioned in economy.Agriculture\nWhich Asian country gave its agricultural sector the largest share of its gross domestic product?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\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: ['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 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_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 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 country (\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\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 island (\n Name text, -- example: ['Aland', 'Alicudi']\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 `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 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 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 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 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 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_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 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 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_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 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 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 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 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 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 are synonyms; Form of governance was mentioned in politics.Government; Least prosperous means lowest GDP\nWhat form of governance does the least prosperous nation in the world 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 T3.Government FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE T2.GDP IS NOT NULL ORDER BY T2.GDP ASC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T3.Government FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE T2.GDP IS NOT NULL ORDER BY T2.GDP ASC LIMIT 1", "index": 4011, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Government text, -- example: ['Government', 'federal republic']\n PRIMARY KEY (Country)\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: ['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 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_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 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 country (\n Code text, -- example: ['A', 'AFG']\n PRIMARY KEY (Code)\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 island (\n Name text, -- example: ['Aland', 'Alicudi']\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 `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 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 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 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 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 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_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 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 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_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 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 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 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 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 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 are synonyms; Form of governance was mentioned in politics.Government; Least prosperous means lowest GDP\nWhat form of governance does the least prosperous nation in the world 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 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 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 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 mountain (\n Name text,\n Longitude real,\n PRIMARY KEY (Name)\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 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: ['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 Industry real, -- example: [64.0, 20.0]\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 island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\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 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);\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 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 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 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 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 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 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_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 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 Longitude real, -- example: [26.0, -69.25]\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 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 PRIMARY KEY (Country)\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 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 Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat year saw the greatest number of organizations created on the European 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 STRFTIME('%Y', T4.Established) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN organization AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Europe' GROUP BY STRFTIME('%Y', T4.Established) ORDER BY COUNT(T4.Name) DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT STRFTIME('%Y', T4.Established) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN organization AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Europe' GROUP BY STRFTIME('%Y', T4.Established) ORDER BY COUNT(T4.Name) DESC LIMIT 1", "index": 4012, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['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 Longitude real,\n PRIMARY KEY (Name)\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 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: ['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 Industry real, -- example: [64.0, 20.0]\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 island (\n Name text, -- example: ['Aland', 'Alicudi']\n Area real, -- example: [650.0, 5.2]\n Longitude real, -- example: [20.0, 14.4]\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 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);\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 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 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 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 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 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 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_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 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 Longitude real, -- example: [26.0, -69.25]\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 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 PRIMARY KEY (Country)\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 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 Lake text, -- example: ['Lake', 'Lake Skutari']\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat year saw the greatest number of organizations created on the European 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 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 Latitude real, -- example: [48.0, 56.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 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_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 mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude 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_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 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 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 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 PRIMARY KEY (Country, Name)\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 Mountains text, -- example: ['Alps', 'East African Rift']\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 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 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_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: ['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: ['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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.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 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 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 province (\n Name text, -- example: ['Borders', '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 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_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 city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['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 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 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:\nNation and country are synonyms\nWhat other country does the most populated nation in the world share a border with and how long is the border between the two 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 T2.Country2, T2.Length 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 = ( SELECT Name FROM country ORDER BY Population DESC LIMIT 1 )", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T2.Country2, T2.Length 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 = ( SELECT Name FROM country ORDER BY Population DESC LIMIT 1 )", "index": 4013, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Latitude real, -- example: [48.0, 56.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 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_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 mountain (\n Name text,\n Mountains text,\n Height real,\n Longitude 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_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 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 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 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 PRIMARY KEY (Country, Name)\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 Mountains text, -- example: ['Alps', 'East African Rift']\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 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 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_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: ['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: ['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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.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 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 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 province (\n Name text, -- example: ['Borders', '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 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_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 city (\n Name text, -- example: ['Aachen', 'Aalborg']\n Country text, -- example: ['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 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 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:\nNation and country are synonyms\nWhat other country does the most populated nation in the world share a border with and how long is the border between the two 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_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 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 mountain (\n Name text,\n Mountains text,\n Height 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 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: ['Province', '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 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: ['Province', '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 country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Distrito Federal', '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 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 sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\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 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 City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Distrito Federal', 'Province', 'al Khartum']\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: ['Distrito Federal', '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 province (\n Name text, -- example: ['Distrito Federal', '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: ['Distrito Federal', '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: ['Distrito Federal', 'Province', '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 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 located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Distrito Federal', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\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 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 Mountains text, -- example: ['Alps', 'East African Rift']\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);\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 geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Distrito Federal', 'Province', '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 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 target (\n Country text, -- example: ['A', 'AFG']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nation and country are synonyms; Gross domestic product = GDP; Portion of GDP devoted to industries appears in economy.Industry; Population Density = Population / Area\nWhat is the population density of the nation whose capital city is in the Distrito Federal province, and what portion of its gross domestic product is devoted to its industries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Province = 'Distrito Federal'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Population / T1.Area, T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Province = 'Distrito Federal'", "index": 4014, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 mountain (\n Name text,\n Mountains text,\n Height 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 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: ['Province', '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 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: ['Province', '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 country (\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\n Province text, -- example: ['Distrito Federal', '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 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 sea (\n Name text, -- example: ['Andaman Sea', 'Arabian Sea']\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 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 City text, -- example: ['City', 'Khartoum']\n Country text, -- example: ['Coun', 'SUD']\n Province text, -- example: ['Distrito Federal', 'Province', 'al Khartum']\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: ['Distrito Federal', '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 province (\n Name text, -- example: ['Distrito Federal', '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: ['Distrito Federal', '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: ['Distrito Federal', 'Province', '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 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 located (\n City text, -- example: ['City', 'Shkoder']\n Province text, -- example: ['Distrito Federal', 'Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\n River text, -- example: ['River', 'Donau']\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 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 Mountains text, -- example: ['Alps', 'East African Rift']\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);\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 geo_sea (\n Sea text, -- example: ['Sea', 'Mediterranean Sea']\n Country text, -- example: ['Coun', 'I']\n Province text, -- example: ['Distrito Federal', 'Province', '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 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 target (\n Country text, -- example: ['A', 'AFG']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nation and country are synonyms; Gross domestic product = GDP; Portion of GDP devoted to industries appears in economy.Industry; Population Density = Population / Area\nWhat is the population density of the nation whose capital city is in the Distrito Federal province, and what portion of its gross domestic product is devoted to its industries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 PRIMARY KEY (Name)\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 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: ['parliamentary democracy', 'parliamentary', 'Government', 'democracy', '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 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 Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\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 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 `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 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: ['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 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 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);\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 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 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 country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\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 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 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 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 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 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_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_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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInhabitants, synonymous with population\nLists all governments with a parliamentary democracy that achieved their independence between 01/01/1950 and 12/31/1999.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT * FROM politics WHERE STRFTIME('%Y', Independence) BETWEEN '1950' AND '1999' AND Government = 'parliamentary democracy'", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT * FROM politics WHERE STRFTIME('%Y', Independence) BETWEEN '1950' AND '1999' AND Government = 'parliamentary democracy'", "index": 4015, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 PRIMARY KEY (Name)\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 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: ['parliamentary democracy', 'parliamentary', 'Government', 'democracy', '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 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 Area real, -- example: [238792.0, 1130.0]\n Capital text, -- example: ['Malakal', 'Colwyn Bay']\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 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 `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 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: ['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 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 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);\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 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 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 country (\n Name text, -- example: ['Afghanistan', 'Albania']\n Code text, -- example: ['A', 'AFG']\n Capital text, -- example: ['Vienna', 'Kabul']\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 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 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 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 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 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_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_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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInhabitants, synonymous with population\nLists all governments with a parliamentary democracy that achieved their independence between 01/01/1950 and 12/31/1999.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 PRIMARY KEY (Country)\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_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 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_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 `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 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 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 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 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 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 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 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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\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 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: ['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 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: ['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 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 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 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:\nPercentage = count(countries independent 1960) / total num of countries\nWhat percentage of countries became independent during the year 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Independence) = '1960' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Independence) = '1960' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics", "index": 4016, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 PRIMARY KEY (Country)\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_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 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_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 `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 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 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 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 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 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 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 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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.0]\n PRIMARY KEY (Name)\n);\n\nCREATE TABLE organization (\n Abbreviation text, -- example: ['ABEDA', 'ACC']\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 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: ['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 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: ['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 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 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 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:\nPercentage = count(countries independent 1960) / total num of countries\nWhat percentage of countries became independent during the year 1960?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 Length real, -- example: [164.0, 362.0]\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_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 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_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 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 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 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 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 River text, -- example: ['River', 'Donau']\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 CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, 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 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 Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\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 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 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 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 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 `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 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 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: ['Abkhaz', 'Acholi']\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 islandIn (\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all deserts that are not between latitudes 30 and 40.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT Name FROM desert WHERE Latitude < 30 OR Latitude > 40", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT Name FROM desert WHERE Latitude < 30 OR Latitude > 40", "index": 4017, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 Length real, -- example: [164.0, 362.0]\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_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 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_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 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 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 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 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 River text, -- example: ['River', 'Donau']\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 CapProv text, -- capital province, example: ['Aali an Nil', 'Aberconwy and Colwyn']\n PRIMARY KEY (Name, 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 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 Percentage real, -- example: [100.0, 90.0]\n PRIMARY KEY (Country, Continent)\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 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 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 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 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 `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 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 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: ['Abkhaz', 'Acholi']\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 islandIn (\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all deserts that are not between latitudes 30 and 40.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 PRIMARY KEY (Code)\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 island (\n Name text, -- example: ['Aland', 'Alicudi']\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 `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\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 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: ['Abkhaz', 'Acholi']\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 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 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: ['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 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 Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\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 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 mountain (\n Name text,\n Mountains 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 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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.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 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_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 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 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 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:\ncoordinates consists of Latitude, Longitude\nIndicate the coordinates of all the deserts whose area is in more than one 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.Latitude, T1.Longitude FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert GROUP BY T1.Name, T1.Latitude, T1.Longitude HAVING COUNT(T1.Name) > 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT T1.Latitude, T1.Longitude FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert GROUP BY T1.Name, T1.Latitude, T1.Longitude HAVING COUNT(T1.Name) > 1", "index": 4018, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 island (\n Name text, -- example: ['Aland', 'Alicudi']\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 `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\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 isMember (\n Country text, -- example: ['A', 'AFG']\n Organization text, -- example: ['AG', 'ANC']\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 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: ['Abkhaz', 'Acholi']\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 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 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: ['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 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 Province text, -- example: ['Province', 'Albania']\n Country text, -- example: ['Coun', 'AL']\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 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 mountain (\n Name text,\n Mountains 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 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 continent (\n Name text, -- example: ['Africa', 'America']\n Area real, -- example: [30254700.0, 39872000.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 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_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 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 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 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:\ncoordinates consists of Latitude, Longitude\nIndicate the coordinates of all the deserts whose area is in more than one 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_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 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 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 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: ['Province', '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: ['Province', '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 mountain (\n Name text,\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 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: ['Less', '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 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_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 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 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 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 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 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 `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\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 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_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 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 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 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 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 desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.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 Latitude real, -- example: [60.1, 38.6]\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:\nAverage population per area = population / area\nWhat is the provincial capital of the province with a population of less than 80,000 that has the highest average population per 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 CapProv FROM province WHERE Population < 80000 ORDER BY Population / Area DESC LIMIT 1", "style": "rule" }
{ "db_id": "mondial_geo.sqlite", "gt_sql": "SELECT CapProv FROM province WHERE Population < 80000 ORDER BY Population / Area DESC LIMIT 1", "index": 4019, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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: ['Province', '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: ['Province', '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 mountain (\n Name text,\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 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: ['Less', '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 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_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 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 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 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 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 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 `language` (\n Country text, -- example: ['AFG', 'NAM']\n Name text, -- example: ['Afghan Persian', 'Afrikaans']\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 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_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 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 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 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 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 desert (\n Name text, -- example: ['Arabian Desert', 'Atacama']\n Area real, -- example: [50000.0, 181300.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 Latitude real, -- example: [60.1, 38.6]\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:\nAverage population per area = population / area\nWhat is the provincial capital of the province with a population of less than 80,000 that has the highest average population per 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 Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR14 real, -- example: [8.679, 7.202]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMARITAL_STATUS = 'Never-married';\nHow many customers have never married?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Never-married'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Never-married'", "index": 4020, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR14 real, -- example: [8.679, 7.202]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMARITAL_STATUS = 'Never-married';\nHow many customers have never married?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 30 refers to age > 30; OCCUPATION = 'Machine-op-inspct';\nAmong the customers over 30, how many of them are Machine-op-inspcts?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(ID) FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age > 30", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(ID) FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age > 30", "index": 4021, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 30 refers to age > 30; OCCUPATION = 'Machine-op-inspct';\nAmong the customers over 30, how many of them are Machine-op-inspcts?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Female', 'Male']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neducation level of 11 refers to EDUCATIONNUM = 11; SEX = 'Female';\nHow many female customers have an education level of over 11?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(ID) FROM Customers WHERE EDUCATIONNUM > 11 AND SEX = 'Female'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(ID) FROM Customers WHERE EDUCATIONNUM > 11 AND SEX = 'Female'", "index": 4022, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Female', 'Male']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neducation level of 11 refers to EDUCATIONNUM = 11; SEX = 'Female';\nHow many female customers have an education level of over 11?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 40 refers to age > 40; RESPONSE = 'true';\nPlease list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age > 40 AND T2.RESPONSE = 'true'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age > 40 AND T2.RESPONSE = 'true'", "index": 4023, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 40 refers to age > 40; RESPONSE = 'true';\nPlease list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR16 real, -- example: [3.5, 7.969]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace with more than 20,000 and less than 30,000 inhabitants refers to GEOID where INHABITANTS_K BETWEEN 20 AND 30; OCCUPATION = 'Machine-op-inspct';\nAmong the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Machine-op-inspct' AND T2.INHABITANTS_K > 20 AND T2.INHABITANTS_K < 30", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Machine-op-inspct' AND T2.INHABITANTS_K > 20 AND T2.INHABITANTS_K < 30", "index": 4024, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR16 real, -- example: [3.5, 7.969]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace with more than 20,000 and less than 30,000 inhabitants refers to GEOID where INHABITANTS_K BETWEEN 20 AND 30; OCCUPATION = 'Machine-op-inspct';\nAmong the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace with the highest average income per month refers to GEOID where MAX(INCOME_K); RESPONSE = 'true';\nHow many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T2.RESPONSE = 'true' ORDER BY T3.INCOME_K DESC LIMIT 1", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T2.RESPONSE = 'true' ORDER BY T3.INCOME_K DESC LIMIT 1", "index": 4025, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace with the highest average income per month refers to GEOID where MAX(INCOME_K); RESPONSE = 'true';\nHow many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace with 44114 inhabitants refers to GEOID where INHABITANTS_K = 44.114; SEX = 'Male';\nAmong the customers who come from the place with 25746 inhabitants, how many of them are male?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 25.746 AND T1.SEX = 'Male'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 25.746 AND T1.SEX = 'Male'", "index": 4026, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplace with 44114 inhabitants refers to GEOID where INHABITANTS_K = 44.114; SEX = 'Male';\nAmong the customers who come from the place with 25746 inhabitants, how many of them are male?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR12 real, -- example: [8.231, 3.72]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRESPONSE = 'true'; AVG(age);\nWhat is the average age of first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT AVG(T1.age) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.RESPONSE = 'true'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT AVG(T1.age) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.RESPONSE = 'true'", "index": 4027, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR12 real, -- example: [8.231, 3.72]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRESPONSE = 'true'; AVG(age);\nWhat is the average age of first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSEX = 'Male';\nHow many of the customers are male?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(ID) FROM Customers WHERE SEX = 'Male'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(ID) FROM Customers WHERE SEX = 'Male'", "index": 4028, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSEX = 'Male';\nHow many of the customers are male?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographic identifier from 20 to 50 refers to GEOID BETWEEN 20 AND 50; number of inhabitants below 20 refers to INHABITANTS_K < 20;\nIn geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(GEOID) FROM Demog WHERE INHABITANTS_K < 20 AND GEOID >= 20 AND GEOID <= 50", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(GEOID) FROM Demog WHERE INHABITANTS_K < 20 AND GEOID >= 20 AND GEOID <= 50", "index": 4029, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographic identifier from 20 to 50 refers to GEOID BETWEEN 20 AND 50; number of inhabitants below 20 refers to INHABITANTS_K < 20;\nIn geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR14 real, -- example: [8.679, 7.202]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographic identifier 239 refers to GEOID = 239; number of inhabitants refers to INHABITANTS_K; income refers to INCOME_K;\nWhat is the number of inhabitants and income of geographic identifier 239?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT INHABITANTS_K FROM Demog WHERE GEOID = 239", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT INHABITANTS_K FROM Demog WHERE GEOID = 239", "index": 4030, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR14 real, -- example: [8.679, 7.202]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographic identifier 239 refers to GEOID = 239; number of inhabitants refers to INHABITANTS_K; income refers to INCOME_K;\nWhat is the number of inhabitants and income of geographic identifier 239?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n MARITAL_STATUS text, -- example: ['Divorced', 'Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of inhabitants refers to INHABITANTS_K; older than 50 years old refers to age < 50; MARITAL_STATUS = 'Divorced;\nList down the number of inhabitants of customers with a divorced marital status and older than 50 years old.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Divorced' AND T1.age < 50", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Divorced' AND T1.age < 50", "index": 4031, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n MARITAL_STATUS text, -- example: ['Divorced', 'Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of inhabitants refers to INHABITANTS_K; older than 50 years old refers to age < 50; MARITAL_STATUS = 'Divorced;\nList down the number of inhabitants of customers with a divorced marital status and older than 50 years old.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of inhabitants ranges of 30 to 40 refers to INHABITANTS_K BETWEEN 30 AND 40;\nWhat is the occupation of customers within number of inhabitants ranges of 30 to 40?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K >= 30 AND T2.INHABITANTS_K <= 40", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K >= 30 AND T2.INHABITANTS_K <= 40", "index": 4032, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of inhabitants ranges of 30 to 40 refers to INHABITANTS_K BETWEEN 30 AND 40;\nWhat is the occupation of customers within number of inhabitants ranges of 30 to 40?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage of 40 to 60 refers to age BETWEEN 40 AND 60; the highest income refers to MAX(INCOME_K);\nList the marital status of customers within the age of 40 to 60 that has the highest income among the group.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.MARITAL_STATUS FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.age >= 40 AND T1.age <= 60 ORDER BY T2.INCOME_K DESC LIMIT 1", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T1.MARITAL_STATUS FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.age >= 40 AND T1.age <= 60 ORDER BY T2.INCOME_K DESC LIMIT 1", "index": 4033, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage of 40 to 60 refers to age BETWEEN 40 AND 60; the highest income refers to MAX(INCOME_K);\nList the marital status of customers within the age of 40 to 60 that has the highest income among the group.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale customers ages from 20 to 30 years old refer to SEX = 'Male' where age BETWEEN 20 AND 30; farming or fishing refers to OCCUPATION; number of inhabitants refers to INHABITANTS_K;\nWhat is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30", "index": 4034, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale customers ages from 20 to 30 years old refer to SEX = 'Male' where age BETWEEN 20 AND 30; farming or fishing refers to OCCUPATION; number of inhabitants refers to INHABITANTS_K;\nWhat is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Married-civ-spouse', 'Never-married']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOCCUPATION = 'Machine-op-inspct'; number of inhabitants refers to INHABITANTS_K;\nAmong the customers with a marital status of married-civ-spouse, list the number of inhabitants and age of those who are machine-op-inspct.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30", "index": 4035, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Married-civ-spouse', 'Never-married']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nOCCUPATION = 'Machine-op-inspct'; number of inhabitants refers to INHABITANTS_K;\nAmong the customers with a marital status of married-civ-spouse, list the number of inhabitants and age of those who are machine-op-inspct.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage greater than the 80% of average age refers to age > (AVG(age) * 0.8); income refers to INCOME_K; number of inhabitants refers to INHABITANTS_K;\nList the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.INCOME_K, T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID GROUP BY T2.INCOME_K, T2.INHABITANTS_K HAVING T1.age > 0.8 * AVG(T1.age)", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T2.INCOME_K, T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID GROUP BY T2.INCOME_K, T2.INHABITANTS_K HAVING T1.age > 0.8 * AVG(T1.age)", "index": 4036, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage greater than the 80% of average age refers to age > (AVG(age) * 0.8); income refers to INCOME_K; number of inhabitants refers to INHABITANTS_K;\nList the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(INCOME_K ≥ 2500 where MARITAL_STATUS = 'Never-married'), COUNT(INCOME_K where MARITAL_STATUS = 'Never-married')) as percentage;\nIn customers with marital status of never married, what is the percentage of customers with income of 2500 and above?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.INCOME_K > 2500 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Never-married'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.INCOME_K > 2500 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Never-married'", "index": 4037, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(INCOME_K ≥ 2500 where MARITAL_STATUS = 'Never-married'), COUNT(INCOME_K where MARITAL_STATUS = 'Never-married')) as percentage;\nIn customers with marital status of never married, what is the percentage of customers with income of 2500 and above?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nelderly customers with an education level below 3 refer to age > 65 where EDUCATIONNUM < 3; geographic ID refers to GEOID;\nFind and list the id and geographic ID of the elderly customers with an education level below 3.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT ID, GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND age > 65", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT ID, GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND age > 65", "index": 4038, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nelderly customers with an education level below 3 refer to age > 65 where EDUCATIONNUM < 3; geographic ID refers to GEOID;\nFind and list the id and geographic ID of the elderly customers with an education level below 3.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2007-02-28 12:00:00.0', '2007-02-01 12:00:00.0', '2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndid not respond refers to RESPONSE = 'false'; February of 2007 refers to REF_DATE BETWEEN '2007-02-01 12:00:00.0'AND '2007-02-28 12:00:00.0';\nCalculate the number of customers who did not respond in February of 2007.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'false' AND REF_DATE BETWEEN '2007-02-01' AND '2007-02-28'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'false' AND REF_DATE BETWEEN '2007-02-01' AND '2007-02-28'", "index": 4039, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2007-02-28 12:00:00.0', '2007-02-01 12:00:00.0', '2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndid not respond refers to RESPONSE = 'false'; February of 2007 refers to REF_DATE BETWEEN '2007-02-01 12:00:00.0'AND '2007-02-28 12:00:00.0';\nCalculate the number of customers who did not respond in February of 2007.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage income per inhabitant above 3000 refers to INCOME_K > 3000; eighties refer to age BETWEEN 80 AND 89; DIVIDE(COUNT(INCOME_K > 3000 and age BETWEEN 80 AND 89), COUNT(INCOME_K > 3000 )) as percentage;\nAmong the customers with an average income per inhabitant above 3000, what percentage are in their eighties?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.age BETWEEN 80 AND 89 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INCOME_K > 3000", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.age BETWEEN 80 AND 89 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INCOME_K > 3000", "index": 4040, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage income per inhabitant above 3000 refers to INCOME_K > 3000; eighties refer to age BETWEEN 80 AND 89; DIVIDE(COUNT(INCOME_K > 3000 and age BETWEEN 80 AND 89), COUNT(INCOME_K > 3000 )) as percentage;\nAmong the customers with an average income per inhabitant above 3000, what percentage are in their eighties?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreference ID refers to REFID;\nHow many of the customer's reference ID that has a TRUE response?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(REFID) FROM Mailings1_2 WHERE RESPONSE = 'true'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(REFID) FROM Mailings1_2 WHERE RESPONSE = 'true'", "index": 4041, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreference ID refers to REFID;\nHow many of the customer's reference ID that has a TRUE response?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreference ID refers to REFID;\nList down the customer's reference ID with true response.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT REFID FROM Mailings1_2 WHERE RESPONSE = 'true'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT REFID FROM Mailings1_2 WHERE RESPONSE = 'true'", "index": 4042, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreference ID refers to REFID;\nList down the customer's reference ID with true response.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographic identifier with an number of inhabitants less than 30 refers to GEOID where INHABITANTS_K < 30;\nList down the geographic identifier with an number of inhabitants less than 30.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30", "index": 4043, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeographic identifier with an number of inhabitants less than 30 refers to GEOID where INHABITANTS_K < 30;\nList down the geographic identifier with an number of inhabitants less than 30.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGEOID BETWEEN 10 AND 30; INCOME_K < 2000;\nIn geographic identifier from 10 to 30, how many of them has an income below 2000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(GEOID) FROM Demog WHERE INCOME_K < 2000 AND GEOID >= 10 AND GEOID <= 30", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(GEOID) FROM Demog WHERE INCOME_K < 2000 AND GEOID >= 10 AND GEOID <= 30", "index": 4044, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGEOID BETWEEN 10 AND 30; INCOME_K < 2000;\nIn geographic identifier from 10 to 30, how many of them has an income below 2000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Widowed', 'Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR14 real, -- example: [8.679, 7.202]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of inhabitants refers to INHABITANTS_K; RESPONSE = 'false';\nList down the number of inhabitants of customers with a widowed marital status and false response .\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.MARITAL_STATUS = 'Widowed' AND T2.RESPONSE = 'true'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.MARITAL_STATUS = 'Widowed' AND T2.RESPONSE = 'true'", "index": 4045, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Widowed', 'Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR14 real, -- example: [8.679, 7.202]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of inhabitants refers to INHABITANTS_K; RESPONSE = 'false';\nList down the number of inhabitants of customers with a widowed marital status and false response .\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Female', 'Male']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale customers with level of education of 3 and below refer to SEX = 'Female' where EDUCATIONNUM ≤ 3; income refers to INCOME_K;\nAmong the female customers with an level of education of 3 and below, list their income.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND SEX = 'Female' )", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND SEX = 'Female' )", "index": 4046, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Female', 'Male']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfemale customers with level of education of 3 and below refer to SEX = 'Female' where EDUCATIONNUM ≤ 3; income refers to INCOME_K;\nAmong the female customers with an level of education of 3 and below, list their income.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale customers ages from 30 to 50 refer to SEX = 'Male' where age BETWEEN 30 AND 50; income ranges from 2000 to 2300 refers to INCOME_K BETWEEN 2000 AND 3000;\nIn male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T1.age >= 30 AND T1.age <= 50 AND T2.INCOME_K >= 2000 AND T2.INCOME_K <= 2300", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T1.age >= 30 AND T1.age <= 50 AND T2.INCOME_K >= 2000 AND T2.INCOME_K <= 2300", "index": 4047, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmale customers ages from 30 to 50 refer to SEX = 'Male' where age BETWEEN 30 AND 50; income ranges from 2000 to 2300 refers to INCOME_K BETWEEN 2000 AND 3000;\nIn male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage of 20 to 30 refers to age BETWEEN 20 AND 30; the highest number of inhabitants refers to MAX(INHABITANTS_K);\nList the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.EDUCATIONNUM, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.age >= 20 AND T1.age <= 30 ORDER BY T3.INHABITANTS_K DESC LIMIT 1", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T1.EDUCATIONNUM, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.age >= 20 AND T1.age <= 30 ORDER BY T3.INHABITANTS_K DESC LIMIT 1", "index": 4048, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR17 real, -- example: [5.512, 8.15]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nage of 20 to 30 refers to age BETWEEN 20 AND 30; the highest number of inhabitants refers to MAX(INHABITANTS_K);\nList the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Handlers-cleaners', 'Machine-op-inspct']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OCCUPATION = 'Handlers-cleaners', SEX = 'Male' and RESPONSE = 'true'), COUNT(OCCUPATION = 'Handlers-cleaners' and SEX = 'Male')) as percentage;\nIn male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.RESPONSE = 'true' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.REFID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.OCCUPATION = 'Handlers-cleaners' AND T1.SEX = 'Male'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.RESPONSE = 'true' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.REFID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.OCCUPATION = 'Handlers-cleaners' AND T1.SEX = 'Male'", "index": 4049, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Handlers-cleaners', 'Machine-op-inspct']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(OCCUPATION = 'Handlers-cleaners', SEX = 'Male' and RESPONSE = 'true'), COUNT(OCCUPATION = 'Handlers-cleaners' and SEX = 'Male')) as percentage;\nIn male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Female', 'Male']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = DIVIDE(COUNT(SEX = 'Male' where age BETWEEN 13 AND 19 and EDUCATIONNUM > 10),COUNT(SEX = 'Female' where age BETWEEN 13 AND 19 and EDUCATIONNUM > 10));\nWhat is the ratio of male and female among the age of teenager when the education is above 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN SEX = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN SEX = 'Female' THEN 1 ELSE 0 END) FROM Customers WHERE age BETWEEN 13 AND 19 AND EDUCATIONNUM > 10", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN SEX = 'Male' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN SEX = 'Female' THEN 1 ELSE 0 END) FROM Customers WHERE age BETWEEN 13 AND 19 AND EDUCATIONNUM > 10", "index": 4050, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Female', 'Male']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = DIVIDE(COUNT(SEX = 'Male' where age BETWEEN 13 AND 19 and EDUCATIONNUM > 10),COUNT(SEX = 'Female' where age BETWEEN 13 AND 19 and EDUCATIONNUM > 10));\nWhat is the ratio of male and female among the age of teenager when the education is above 10?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR15 real, -- example: [5.292, 4.932]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal income per year refers to MULTIPLY(12, INHABITANTS_K, INCOME_K) where INCOME_K > 3300; geographic ID refers to GEOID;\nWhat is the geographic ID and total income per year when the average income is above 3300 dollar.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT GEOID, INHABITANTS_K * INCOME_K * 12 FROM Demog WHERE INCOME_K > 3300", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT GEOID, INHABITANTS_K * INCOME_K * 12 FROM Demog WHERE INCOME_K > 3300", "index": 4051, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR15 real, -- example: [5.292, 4.932]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal income per year refers to MULTIPLY(12, INHABITANTS_K, INCOME_K) where INCOME_K > 3300; geographic ID refers to GEOID;\nWhat is the geographic ID and total income per year when the average income is above 3300 dollar.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGEOID = 134;\nFind the response status to customer whose geographic ID of 134.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.RESPONSE FROM Customers AS T1 INNER JOIN mailings3 AS T2 ON T1.ID = T2.REFID WHERE T1.GEOID = 134", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T2.RESPONSE FROM Customers AS T1 INNER JOIN mailings3 AS T2 ON T1.ID = T2.REFID WHERE T1.GEOID = 134", "index": 4052, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGEOID = 134;\nFind the response status to customer whose geographic ID of 134.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe average income per month refers to INCOME_K; yearly income of geographic ID refers to GEOID where MULTIPLY(INHABITANTS_K, INCOME_K, 12);\nDescribe the average income per month and yearly income of the geographic ID in which customer of ID \"209556\" and \"290135\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.INCOME_K, T2.INHABITANTS_K * T2.INCOME_K * 12 FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 209556 OR T1.ID = 290135", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T2.INCOME_K, T2.INHABITANTS_K * T2.INCOME_K * 12 FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 209556 OR T1.ID = 290135", "index": 4053, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n RESPONSE text, -- example: ['false', 'true']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe average income per month refers to INCOME_K; yearly income of geographic ID refers to GEOID where MULTIPLY(INHABITANTS_K, INCOME_K, 12);\nDescribe the average income per month and yearly income of the geographic ID in which customer of ID \"209556\" and \"290135\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreference ID of under 10 refers to REFID < 10; got response refers to RESPONSE = 'true'; education status refers to EDUCATIONNUM;\nAmong the reference ID of under 10 who got response by marketing department, compare their education status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.EDUCATIONNUM FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.REFID < 10 AND T2.RESPONSE = 'true'", "style": "rule" }
{ "db_id": "software_company.sqlite", "gt_sql": "SELECT T1.EDUCATIONNUM FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.REFID < 10 AND T2.RESPONSE = 'true'", "index": 4054, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE mailings3 (\n REFID integer, -- REFERENCE ID, example: [60000, 60001]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-07-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\n\nCREATE TABLE Customers (\n ID integer, -- example: [0, 1]\n SEX text, -- example: ['Male', 'Female']\n MARITAL_STATUS text, -- example: ['Never-married', 'Married-civ-spouse']\n GEOID integer, -- GEOGRAPHIC ID, example: [61, 70]\n EDUCATIONNUM integer, -- EDUCATION NUMBER, example: [7, 3]\n OCCUPATION text, -- example: ['Machine-op-inspct', 'Handlers-cleaners']\n age integer, -- example: [62, 78]\n PRIMARY KEY (ID)\n);\n\nCREATE TABLE Demog (\n GEOID integer, -- GEOGRAPHIC ID, example: [0, 1]\n INHABITANTS_K real, -- INHABITANTS (THOUSANDS), example: [30.046, 36.25]\n INCOME_K real, -- INCOME (THOUSANDS), example: [2631.47, 3012.75]\n A_VAR1 real, -- example: [6.084, 4.604]\n A_VAR2 real, -- example: [5.79, 8.309]\n A_VAR3 real, -- example: [8.595, 6.007]\n A_VAR4 real, -- example: [3.935, 5.938]\n A_VAR5 real, -- example: [6.362, 8.773]\n A_VAR6 real, -- example: [8.626, 3.579]\n A_VAR7 real, -- example: [4.624, 6.349]\n A_VAR8 real, -- example: [8.324, 4.694]\n A_VAR9 real, -- example: [5.233, 6.884]\n A_VAR10 real, -- example: [6.232, 7.062]\n A_VAR11 real, -- example: [5.205, 7.319]\n A_VAR12 real, -- example: [8.231, 3.72]\n A_VAR13 real, -- example: [6.746, 6.405]\n A_VAR14 real, -- example: [8.679, 7.202]\n A_VAR15 real, -- example: [5.292, 4.932]\n A_VAR16 real, -- example: [3.5, 7.969]\n A_VAR17 real, -- example: [5.512, 8.15]\n A_VAR18 real, -- example: [5.783, 5.633]\n PRIMARY KEY (GEOID)\n);\n\nCREATE TABLE Sales (\n EVENTID integer, -- example: [0, 1]\n REFID integer, -- REFERENCE ID, example: [0, 1]\n EVENT_DATE datetime, -- example: ['2006-12-21 12:00:00.0', '2006-12-25 12:00:00.0']\n AMOUNT real, -- example: [17.907, 17.401]\n PRIMARY KEY (EVENTID)\n);\n\nCREATE TABLE Mailings1_2 (\n REFID integer, -- REFERENCE ID, example: [0, 1]\n REF_DATE datetime, -- REFERENCE DATE, example: ['2007-02-01 12:00:00.0', '2007-03-01 12:00:00.0']\n RESPONSE text, -- example: ['true', 'false']\n PRIMARY KEY (REFID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreference ID of under 10 refers to REFID < 10; got response refers to RESPONSE = 'true'; education status refers to EDUCATIONNUM;\nAmong the reference ID of under 10 who got response by marketing department, compare their education status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to side = 'Central'\nHow many community areas are there in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Community_Area WHERE side = 'Central'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Community_Area WHERE side = 'Central'", "index": 4055, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to side = 'Central'\nHow many community areas are there in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Lincoln Square', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Lincoln', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Lincoln Square', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndistrict refers to side; community area Lincoln Square refers to community_area_name = 'Lincoln Square'\nWhich district is the community area Lincoln Square grouped into?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT side FROM Community_Area WHERE community_area_name = 'Lincoln Square'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT side FROM Community_Area WHERE community_area_name = 'Lincoln Square'", "index": 4056, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Lincoln Square', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Lincoln', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Lincoln Square', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndistrict refers to side; community area Lincoln Square refers to community_area_name = 'Lincoln Square'\nWhich district is the community area Lincoln Square grouped into?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe person responsible for the crime cases refers to commander; Central Chicago refers to district_name = 'Central'\nWho is the person responsible for the crime cases in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT commander FROM District WHERE district_name = 'Central'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT commander FROM District WHERE district_name = 'Central'", "index": 4057, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe person responsible for the crime cases refers to commander; Central Chicago refers to district_name = 'Central'\nWho is the person responsible for the crime cases in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Lincoln', 'Central', 'Wentworth']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Lincoln Square', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Lincoln Square', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe community area of Lincoln Square refers to community_area_name = 'Lincoln Square'\nHow many neighborhoods are there in the community area of Lincoln Square?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.community_area_no) FROM ( SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE community_area_name = 'Lincoln Square' GROUP BY T1.community_area_no ) T3", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(T3.community_area_no) FROM ( SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE community_area_name = 'Lincoln Square' GROUP BY T1.community_area_no ) T3", "index": 4058, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Lincoln', 'Central', 'Wentworth']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Lincoln Square', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Lincoln Square', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe community area of Lincoln Square refers to community_area_name = 'Lincoln Square'\nHow many neighborhoods are there in the community area of Lincoln Square?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Central', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n ward_office_zip text, -- example: ['60647', '60622']\n city_hall_office_room integer, -- example: [200, 305]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of neighborhood refers to neighborhood_name; Central Chicago refers to side = 'Central'\nPlease list the names of all the neighborhoods in Central Chicago.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.side = 'Central'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.side = 'Central'", "index": 4059, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Central', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n ward_office_zip text, -- example: ['60647', '60622']\n city_hall_office_room integer, -- example: [200, 305]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of neighborhood refers to neighborhood_name; Central Chicago refers to side = 'Central'\nPlease list the names of all the neighborhoods in Central Chicago.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to district_name = 'Central'\nHow many crimes had happened in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central'", "index": 4060, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to district_name = 'Central'\nHow many crimes had happened in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_name_suffix text, -- example: ['Jr.']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to district_name = 'Central'; case of domestic violence refers to domestic = 'TRUE'\nAmong all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.domestic = 'TRUE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.domestic = 'TRUE'", "index": 4061, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_name_suffix text, -- example: ['Jr.']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to district_name = 'Central'; case of domestic violence refers to domestic = 'TRUE'\nAmong all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno arrest made refers to arrest = 'FALSE'; Central Chicago refers to district_name = 'Central'\nPlease list the case numbers of all the crimes with no arrest made in Central Chicago.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.arrest = 'FALSE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.arrest = 'FALSE'", "index": 4062, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno arrest made refers to arrest = 'FALSE'; Central Chicago refers to district_name = 'Central'\nPlease list the case numbers of all the crimes with no arrest made in Central Chicago.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Woodlawn', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Woodlawn', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWoodlawn refers to community_area_name = 'Woodlawn'; in January 2018 refers to date like '%1/2018%'\nAmong the crimes in Woodlawn, how many of them happened in January, 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.community_area_name = 'Woodlawn' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.date LIKE '%1/2018%'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.community_area_name = 'Woodlawn' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.date LIKE '%1/2018%'", "index": 4063, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Woodlawn', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Woodlawn', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWoodlawn refers to community_area_name = 'Woodlawn'; in January 2018 refers to date like '%1/2018%'\nAmong the crimes in Woodlawn, how many of them happened in January, 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfax number refers to fax; the most number of crimes refers to max(count(case_number)); in January 2018 refers to date like '%1/2018%'\nWhat is the fax number for the district with the most number of crimes in January, 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.fax FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.date LIKE '%1/2018%' GROUP BY T2.district_no ORDER BY COUNT(case_number) DESC LIMIT 1", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T1.fax FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.date LIKE '%1/2018%' GROUP BY T2.district_no ORDER BY COUNT(case_number) DESC LIMIT 1", "index": 4064, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfax number refers to fax; the most number of crimes refers to max(count(case_number)); in January 2018 refers to date like '%1/2018%'\nWhat is the fax number for the district with the most number of crimes in January, 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to side = 'Central'; average number = divide(count(report_no), count(community_area_no))\nWhat is the average number of crimes in a neighborhood in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(T1.report_no) AS REAL) / COUNT(T2.community_area_no) FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.side = 'Central'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT CAST(COUNT(T1.report_no) AS REAL) / COUNT(T2.community_area_no) FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.side = 'Central'", "index": 4065, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Central', 'Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nCentral Chicago refers to side = 'Central'; average number = divide(count(report_no), count(community_area_no))\nWhat is the average number of crimes in a neighborhood in Central Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Near North Side', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Far North side refers to side = 'Far North'\nHow many community areas are in the Far North side?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Community_Area WHERE side = 'Far North '", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Community_Area WHERE side = 'Far North '", "index": 4066, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Near North Side', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Far North side refers to side = 'Far North'\nHow many community areas are in the Far North side?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Morgan Park', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Morgan Park', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMorgan Park district refers to district_name = 'Morgan Park'\nWho is the commander of Morgan Park district?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT commander FROM District WHERE district_name = 'Morgan Park'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT commander FROM District WHERE district_name = 'Morgan Park'", "index": 4067, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Morgan Park', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Morgan Park', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMorgan Park district refers to district_name = 'Morgan Park'\nWho is the commander of Morgan Park district?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_name_suffix text, -- example: ['Jr.']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinate (41.66236555, -87.63470194) refers to latitude = '41.66236555' AND longitude = '-87.63470194'; name of the district refers to district_name\nWhere is the coordinate (41.66236555, -87.63470194) located? Give the name of the district.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.district_name FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.longitude = '-87.63470194' AND T1.latitude = '41.66236555'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.district_name FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.longitude = '-87.63470194' AND T1.latitude = '41.66236555'", "index": 4068, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_name_suffix text, -- example: ['Jr.']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinate (41.66236555, -87.63470194) refers to latitude = '41.66236555' AND longitude = '-87.63470194'; name of the district refers to district_name\nWhere is the coordinate (41.66236555, -87.63470194) located? Give the name of the district.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB296775', 'JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindex code refers to iucr_no; case JB296775 refers to case_number = 'JB296775'\nHow severe was case JB296775? Give the index code for severity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.iucr_no FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.case_number = 'JB296775'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.iucr_no FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.case_number = 'JB296775'", "index": 4069, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB296775', 'JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nindex code refers to iucr_no; case JB296775 refers to case_number = 'JB296775'\nHow severe was case JB296775? Give the index code for severity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB103470', 'JB100159', 'JB100522']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase No. JB103470 refers to case_number = 'JB103470'; full name refers to alderman_first_name, alderman_last_name\nWho was the alderman of the legislative district where case No. JB103470 took place? Give the 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.alderman_first_name, T1.alderman_last_name FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.case_number = 'JB103470'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T1.alderman_first_name, T1.alderman_last_name FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.case_number = 'JB103470'", "index": 4070, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB103470', 'JB100159', 'JB100522']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase No. JB103470 refers to case_number = 'JB103470'; full name refers to alderman_first_name, alderman_last_name\nWho was the alderman of the legislative district where case No. JB103470 took place? Give the 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 District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Roseland', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Roseland', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRoseland community refers to community_area_name = 'Roseland'\nHow many different neighborhoods are there in Roseland community?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.community_area_name = 'Roseland' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.community_area_name = 'Roseland' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no", "index": 4071, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Roseland', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Roseland', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRoseland community refers to community_area_name = 'Roseland'\nHow many different neighborhoods are there in Roseland community?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB134191', 'JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase No.JB134191 refers to case_number = 'JB134191'\nGive the FBI code description of case No.JB134191.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT description FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.case_number = 'JB134191'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT description FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.case_number = 'JB134191'", "index": 4072, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB134191', 'JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase No.JB134191 refers to case_number = 'JB134191'\nGive the FBI code description of case No.JB134191.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['North Lawndale', 'Rogers Park', 'West Ridge']\n side text, -- example: ['North ', 'Far North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n phone text, -- example: ['312-745-4290', '312-747-8366']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['North Lawndale', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of cases refers to count(case_number); arrest refers to arrest = 'TRUE'; North Lawndale community refers to community_area_name = 'North Lawndale'\nTell the number of cases with arrests in North Lawndale community.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.community_area_name = 'North Lawndale' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.arrest = 'TRUE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.community_area_name = 'North Lawndale' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.arrest = 'TRUE'", "index": 4073, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['North Lawndale', 'Rogers Park', 'West Ridge']\n side text, -- example: ['North ', 'Far North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n phone text, -- example: ['312-745-4290', '312-747-8366']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['North Lawndale', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of cases refers to count(case_number); arrest refers to arrest = 'TRUE'; North Lawndale community refers to community_area_name = 'North Lawndale'\nTell the number of cases with arrests in North Lawndale community.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['ABANDONED BUILDING', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; in an abandoned building refers to location_description = 'ABANDONED BUILDING'; in 2018 refers to date LIKE '%2018%'\nHow many incidents of domestic violence occurred in an abandoned building in 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN location_description = 'ABANDONED BUILDING' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND domestic = 'TRUE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN location_description = 'ABANDONED BUILDING' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND domestic = 'TRUE'", "index": 4074, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['ABANDONED BUILDING', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; in an abandoned building refers to location_description = 'ABANDONED BUILDING'; in 2018 refers to date LIKE '%2018%'\nHow many incidents of domestic violence occurred in an abandoned building in 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n phone text, -- example: ['312-745-4290', '312-747-8366']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe least population refers = min(sum(population))\nWhat is the population of the district with the least 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 SUM(population) FROM Community_Area GROUP BY side ORDER BY SUM(population) LIMIT 1", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(population) FROM Community_Area GROUP BY side ORDER BY SUM(population) LIMIT 1", "index": 4075, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n phone text, -- example: ['312-745-4290', '312-747-8366']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe least population refers = min(sum(population))\nWhat is the population of the district with the least 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 Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['ANIMAL HOSPITAL', 'HOSPITAL', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['08B', '01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['08B', '01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\narrest refers to arrest = 'TRUE'; in 2018 refers to date LIKE '%2018%'; in an animal hospital refers to location_description = 'ANIMAL HOSPITAL'; FBI code 08B refers to fbi_code_no = '08B'\nHow many arrests were made in 2018 in an animal hospital under FBI code 08B?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND location_description = 'ANIMAL HOSPITAL' AND fbi_code_no = '08B'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND location_description = 'ANIMAL HOSPITAL' AND fbi_code_no = '08B'", "index": 4076, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['ANIMAL HOSPITAL', 'HOSPITAL', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['08B', '01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['08B', '01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\narrest refers to arrest = 'TRUE'; in 2018 refers to date LIKE '%2018%'; in an animal hospital refers to location_description = 'ANIMAL HOSPITAL'; FBI code 08B refers to fbi_code_no = '08B'\nHow many arrests were made in 2018 in an animal hospital under FBI code 08B?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Disorderly Conduct', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommanding officer refers to commander; the highest number refers to max(count(district_no)); disorderly conduct refers to title = 'Disorderly Conduct'\nWho is the commanding officer in the district with the highest number of disorderly conduct?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Disorderly Conduct' AND T2.fbi_code_no = 24 GROUP BY T2.fbi_code_no ORDER BY COUNT(T1.district_no) DESC LIMIT 1", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T1.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Disorderly Conduct' AND T2.fbi_code_no = 24 GROUP BY T2.fbi_code_no ORDER BY COUNT(T1.district_no) DESC LIMIT 1", "index": 4077, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Disorderly Conduct', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommanding officer refers to commander; the highest number refers to max(count(district_no)); disorderly conduct refers to title = 'Disorderly Conduct'\nWho is the commanding officer in the district with the highest number of disorderly conduct?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Albany Park', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['CRIMINAL SEXUAL ABUSE', 'AGG CRIMINAL SEXUAL ABUSE', 'FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['APARTMENT', 'AUTO']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Criminal Sexual Abuse', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Albany Park', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlbany Park refers to district_name = 'Albany Park'; in an apartment refers to location_description = 'APARTMENT'; criminal sexual abuse refers to title = 'Criminal Sexual Abuse'\nIn Albany Park, how many arrests were made in an apartment due to criminal sexual abuse?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T3.title = 'Criminal Sexual Abuse' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.district_name = 'Albany Park' AND T2.arrest = 'TRUE' AND T2.location_description = 'APARTMENT'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T3.title = 'Criminal Sexual Abuse' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.district_name = 'Albany Park' AND T2.arrest = 'TRUE' AND T2.location_description = 'APARTMENT'", "index": 4078, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Albany Park', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['CRIMINAL SEXUAL ABUSE', 'AGG CRIMINAL SEXUAL ABUSE', 'FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['APARTMENT', 'AUTO']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Criminal Sexual Abuse', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Albany Park', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlbany Park refers to district_name = 'Albany Park'; in an apartment refers to location_description = 'APARTMENT'; criminal sexual abuse refers to title = 'Criminal Sexual Abuse'\nIn Albany Park, how many arrests were made in an apartment due to criminal sexual abuse?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Rogers Park', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Robbery', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['ROBBERY', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location or coordinate refers to latitude, longitude; most refers to fbi_code_no = 3; robbery refers to title = 'Robbery'; Rogers Park refers to community_area_name = 'Rogers Park'\nWhat is the precise location or coordinate where most of the robberies in Rogers Park occurred?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.latitude, T2.longitude FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.community_area_name = 'Rogers Park' AND T3.title = 'Robbery' AND T3.fbi_code_no = 3", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.latitude, T2.longitude FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.community_area_name = 'Rogers Park' AND T3.title = 'Robbery' AND T3.fbi_code_no = 3", "index": 4079, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Rogers Park', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Robbery', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['ROBBERY', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location or coordinate refers to latitude, longitude; most refers to fbi_code_no = 3; robbery refers to title = 'Robbery'; Rogers Park refers to community_area_name = 'Rogers Park'\nWhat is the precise location or coordinate where most of the robberies in Rogers Park occurred?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Near North Side', 'Rogers Park', 'West Ridge']\n side text, -- example: ['North ', 'Far North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Near North Side', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNear North Side refers to community_area_name = 'Near North Side'\nHow many neighborhoods are there in Near North Side?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.community_area_name = 'Near North Side' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.community_area_name = 'Near North Side' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no", "index": 4080, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n zip_code integer, -- example: [60616, 60609]\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Near North Side', 'Rogers Park', 'West Ridge']\n side text, -- example: ['North ', 'Far North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Near North Side', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nNear North Side refers to community_area_name = 'Near North Side'\nHow many neighborhoods are there in Near North Side?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['010XX W LAKE ST', '039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['OFFICE', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe legislative district's office address refers to ward_office_address; 010XX W LAKE ST refers to block = '010XX W LAKE ST'\nWhat is the legislative district's office address where 010XX W LAKE ST 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 T1.ward_office_address FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.block = '010XX W LAKE ST' GROUP BY T1.ward_office_address", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T1.ward_office_address FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.block = '010XX W LAKE ST' GROUP BY T1.ward_office_address", "index": 4081, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['010XX W LAKE ST', '039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['OFFICE', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe legislative district's office address refers to ward_office_address; 010XX W LAKE ST refers to block = '010XX W LAKE ST'\nWhat is the legislative district's office address where 010XX W LAKE ST 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 Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['PROSTITUTION', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the community refers to community_area_name; the highest number of crimes refers to max(case_number); prostitution refers to primary_description = 'PROSTITUTION'\nWhat is the name of the community that has the highest number of crimes related to prostitution?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.community_area_name FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no INNER JOIN Community_Area AS T3 ON T1.community_area_no = T3.community_area_no WHERE T2.primary_description = 'PROSTITUTION' GROUP BY T1.iucr_no ORDER BY T1.case_number DESC LIMIT 1", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T3.community_area_name FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no INNER JOIN Community_Area AS T3 ON T1.community_area_no = T3.community_area_no WHERE T2.primary_description = 'PROSTITUTION' GROUP BY T1.iucr_no ORDER BY T1.case_number DESC LIMIT 1", "index": 4082, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['PROSTITUTION', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname of the community refers to community_area_name; the highest number of crimes refers to max(case_number); prostitution refers to primary_description = 'PROSTITUTION'\nWhat is the name of the community that has the highest number of crimes related to prostitution?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Vandalism', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Edward', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Burke', 'La Spata', 'Hopkins']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvandalism refers to title = 'Vandalism'; arrested refers to arrest = 'TRUE'\nHow many vandalisms were arrested in the ward represented by Edward Burke?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.alderman_last_name = 'Burke' THEN 1 ELSE 0 END) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Vandalism' AND T2.arrest = 'TRUE' AND T1.alderman_first_name = 'Edward'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.alderman_last_name = 'Burke' THEN 1 ELSE 0 END) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Vandalism' AND T2.arrest = 'TRUE' AND T1.alderman_first_name = 'Edward'", "index": 4083, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Vandalism', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Edward', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Burke', 'La Spata', 'Hopkins']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nvandalism refers to title = 'Vandalism'; arrested refers to arrest = 'TRUE'\nHow many vandalisms were arrested in the ward represented by Edward Burke?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; in May 2018 refers to date LIKE '5/%/2018%'\nHow many domestic violence cases were reported in May 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(*) FROM Crime WHERE date LIKE '5/%/2018%' AND domestic = 'TRUE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Crime WHERE date LIKE '5/%/2018%' AND domestic = 'TRUE'", "index": 4084, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; in May 2018 refers to date LIKE '5/%/2018%'\nHow many domestic violence cases were reported in May 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Chicago Lawn', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Chicago Lawn', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Chicago Lawn', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresponsible person refers to commander; email address refers to email; Chicago Lawn refers to district_name = 'Chicago Lawn'\nProvide the responsible person and his/her email address of Chicago Lawn.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT commander, email FROM District WHERE district_name = 'Chicago Lawn'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT commander, email FROM District WHERE district_name = 'Chicago Lawn'", "index": 4085, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Chicago Lawn', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Chicago Lawn', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Chicago Lawn', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nresponsible person refers to commander; email address refers to email; Chicago Lawn refers to district_name = 'Chicago Lawn'\nProvide the responsible person and his/her email address of Chicago Lawn.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Northwest ', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Northwest refers to side = 'Northwest'\nList the community area names in the Northwest.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT community_area_name FROM Community_Area WHERE side = 'Northwest'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT community_area_name FROM Community_Area WHERE side = 'Northwest'", "index": 4086, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Northwest ', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe Northwest refers to side = 'Northwest'\nList the community area names in the Northwest.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncrime case against persons refers to crime_against = 'Persons'\nList down the titles and descriptions of the crimes cases against persons.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT title, description FROM FBI_Code WHERE crime_against = 'Persons'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT title, description FROM FBI_Code WHERE crime_against = 'Persons'", "index": 4087, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncrime case against persons refers to crime_against = 'Persons'\nList down the titles and descriptions of the crimes cases against persons.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nspecific description refers to secondary_description; location refers to latitude, longitude; IUCR 142 refers to iucr_no = 142\nDescribe the specific description and case locations under IUCR 142.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.secondary_description, T2.latitude, T2.longitude FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.iucr_no = 142", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T1.secondary_description, T2.latitude, T2.longitude FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.iucr_no = 142", "index": 4088, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nspecific description refers to secondary_description; location refers to latitude, longitude; IUCR 142 refers to iucr_no = 142\nDescribe the specific description and case locations under IUCR 142.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Brendan', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Reilly', 'La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n7th October 2018 refers to date like '10/7/2018%'\nHow many crimes were handled by Brendan Reilly on 7th October 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T2.alderman_last_name = 'Reilly' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN Ward AS T2 ON T1.ward_no = T2.ward_no WHERE T2.alderman_name_suffix IS NULL AND T2.alderman_first_name = 'Brendan' AND date LIKE '10/7/2018%'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.alderman_last_name = 'Reilly' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN Ward AS T2 ON T1.ward_no = T2.ward_no WHERE T2.alderman_name_suffix IS NULL AND T2.alderman_first_name = 'Brendan' AND date LIKE '10/7/2018%'", "index": 4089, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Brendan', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Reilly', 'La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n7th October 2018 refers to date like '10/7/2018%'\nHow many crimes were handled by Brendan Reilly on 7th October 2018?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n block text, -- example: ['0000X N FRANCISCO AVE', '039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naldermen's full name refers to alderman_name_suffix, alderman_first_name, alderman_last_name; 0000X N FRANCISCO AVE refers to block = '0000X N FRANCISCO AVE'\nProvide case numbers, aldermen's full names, and district names of the crimes that happened in 0000X N FRANCISCO AVE.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.case_number, T3.alderman_first_name, T3.alderman_last_name, T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN Ward AS T3 ON T2.ward_no = T3.ward_no WHERE T2.block = '0000X N FRANCISCO AVE' GROUP BY T2.case_number, T3.alderman_first_name, T3.alderman_last_name, T1.district_name", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.case_number, T3.alderman_first_name, T3.alderman_last_name, T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN Ward AS T3 ON T2.ward_no = T3.ward_no WHERE T2.block = '0000X N FRANCISCO AVE' GROUP BY T2.case_number, T3.alderman_first_name, T3.alderman_last_name, T1.district_name", "index": 4090, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n block text, -- example: ['0000X N FRANCISCO AVE', '039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naldermen's full name refers to alderman_name_suffix, alderman_first_name, alderman_last_name; 0000X N FRANCISCO AVE refers to block = '0000X N FRANCISCO AVE'\nProvide case numbers, aldermen's full names, and district names of the crimes that happened in 0000X N FRANCISCO AVE.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Douglas', 'Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneighborhood area refers to neighborhood_name; Douglas refers to community_area_name = 'Douglas'\nList down the neighborhood areas of Douglas.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'Douglas'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'Douglas'", "index": 4091, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Douglas', 'Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneighborhood area refers to neighborhood_name; Douglas refers to community_area_name = 'Douglas'\nList down the neighborhood areas of Douglas.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['West Pullman', 'Pullman', 'Rogers Park', 'West Ridge']\n side text, -- example: ['West ', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['West Pullman', 'Pullman', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; arrested refers to arrest = 'TRUE'; West Pullman refers to community_area_name = 'West Pullman'; percent = divide(count(report_no where arrest = 'TRUE'), count(report_no)) where domestic = 'TRUE' and community_area_name = 'West Pullman' * 100%\nHow many percent of domestic violence cases were arrested in West Pullman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(CASE WHEN T2.arrest = 'TRUE' THEN T2.report_no END) AS REAL) * 100 / COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'West Pullman' AND T2.domestic = 'TRUE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.arrest = 'TRUE' THEN T2.report_no END) AS REAL) * 100 / COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'West Pullman' AND T2.domestic = 'TRUE'", "index": 4092, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['West Pullman', 'Pullman', 'Rogers Park', 'West Ridge']\n side text, -- example: ['West ', 'Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['West Pullman', 'Pullman', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; arrested refers to arrest = 'TRUE'; West Pullman refers to community_area_name = 'West Pullman'; percent = divide(count(report_no where arrest = 'TRUE'), count(report_no)) where domestic = 'TRUE' and community_area_name = 'West Pullman' * 100%\nHow many percent of domestic violence cases were arrested in West Pullman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['James', 'Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n PRIMARY KEY (district_no)\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 aldermen have \"James\" as their first 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 COUNT(*) FROM Ward WHERE alderman_first_name = 'James'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT COUNT(*) FROM Ward WHERE alderman_first_name = 'James'", "index": 4093, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['James', 'Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n PRIMARY KEY (district_no)\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 aldermen have \"James\" as their first 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 Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Edward', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Burke', 'La Spata', 'Hopkins']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest population refers to max(population); report number refers to report_no; the highest beat refers to max(beat)\nAmong the cases reported in the ward with Edward Burke as the alderman and happened in the community area with the highest population, provide the report number of the crime with the highest beat.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.report_no FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T1.alderman_first_name = 'Edward' AND T1.alderman_last_name = 'Burke' ORDER BY T2.beat DESC, T3.population DESC LIMIT 1", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.report_no FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T1.alderman_first_name = 'Edward' AND T1.alderman_last_name = 'Burke' ORDER BY T2.beat DESC, T3.population DESC LIMIT 1", "index": 4094, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Edward', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Burke', 'La Spata', 'Hopkins']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest population refers to max(population); report number refers to report_no; the highest beat refers to max(beat)\nAmong the cases reported in the ward with Edward Burke as the alderman and happened in the community area with the highest population, provide the report number of the crime with the highest beat.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['STREET', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the street refers to location_description = 'STREET'\nHow many of the crimes that happened in the street have FBI title \"Homicide 1st & 2nd Degree\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T2.location_description = 'STREET' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no WHERE T1.title = 'Homicide 1st & 2nd Degree'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T2.location_description = 'STREET' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no WHERE T1.title = 'Homicide 1st & 2nd Degree'", "index": 4095, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['STREET', 'AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n PRIMARY KEY (fbi_code_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin the street refers to location_description = 'STREET'\nHow many of the crimes that happened in the street have FBI title \"Homicide 1st & 2nd Degree\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalderman refers to alderman_suffix, alderman_first_name, alderman_last_name; report number 23769 refers to report_no = 23769\nWho is the alderman in the ward associated with the crime with report number 23769?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.alderman_first_name, T2.alderman_last_name FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T1.report_no = 23769", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.alderman_first_name, T2.alderman_last_name FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T1.report_no = 23769", "index": 4096, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n domestic text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n city_hall_office_fax text, -- example: ['312.744.6712', '312.744.7738']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nalderman refers to alderman_suffix, alderman_first_name, alderman_last_name; report number 23769 refers to report_no = 23769\nWho is the alderman in the ward associated with the crime with report number 23769?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Lincoln Square', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Lincoln', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Lincoln Square', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; Lincoln Square refers to community_area_name = 'Lincoln Square'\nList the case numbers of domestic violence crimes reported in Lincoln Square.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.case_number FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'Lincoln Square' AND T2.domestic = 'TRUE'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT T2.case_number FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'Lincoln Square' AND T2.domestic = 'TRUE'", "index": 4097, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Lincoln Square', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Lincoln', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n block text, -- example: ['039XX W CORNELIA AVE', '026XX N HAMPDEN CT']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['TRUE', 'FALSE']\n domestic text, -- example: ['TRUE', 'FALSE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Lincoln Square', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndomestic violence refers to domestic = 'TRUE'; Lincoln Square refers to community_area_name = 'Lincoln Square'\nList the case numbers of domestic violence crimes reported in Lincoln Square.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Near North Side', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Near North Side', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreport number refers to report_no; the far north side refers to side = 'Far North'; population greater than 60,000 refers to population > '60000'\nList the report number of crimes reported in a community area in the far north side with a population greater than 60,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 SUM(CASE WHEN T1.population > 60000 THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.side = 'Far North '", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.population > 60000 THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.side = 'Far North '", "index": 4098, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n alderman_last_name text, -- example: ['La Spata', 'Hopkins']\n alderman_name_suffix text, -- example: ['Jr.']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n city_hall_office_room integer, -- example: [200, 305]\n city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n tty text, -- example: ['312-745-3693', '312-747-6656']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\n description text, -- example: ['The killing of one human being by anothe', 'The killing of another person through ne']\n crime_against text, -- example: ['Persons', 'Property']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Near North Side', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n `date` text, -- example: ['1/1/2018 2:46', '1/1/2018 11:33']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n beat integer, -- example: [1732, 1935]\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n longitude text, -- example: ['-87.72668181', '-87.64092074']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n index_code text, -- example: ['I', 'N']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Near North Side', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreport number refers to report_no; the far north side refers to side = 'Far North'; population greater than 60,000 refers to population > '60000'\nList the report number of crimes reported in a community area in the far north side with a population greater than 60,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 FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Property', 'Persons']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Riverdale', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Riverdale', 'Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncrime against property refers to crime_against = 'Property'; Riverdale refers to community_area_name = 'Riverdale'\nList the report number of crimes against property happened in Riverdale.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN T1.crime_against = 'Property' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T3.community_area_name = 'Riverdale'", "style": "rule" }
{ "db_id": "chicago_crime.sqlite", "gt_sql": "SELECT SUM(CASE WHEN T1.crime_against = 'Property' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T3.community_area_name = 'Riverdale'", "index": 4099, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n crime_against text, -- example: ['Property', 'Persons']\n PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n phone text, -- example: ['312-745-4290', '312-747-8366']\n fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\n PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE Crime (\n report_no integer, -- report number, example: [23757, 23758]\n case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['AUTO', 'APARTMENT']\n arrest text, -- example: ['FALSE', 'TRUE']\n district_no integer, -- district number, example: [17, 19]\n ward_no integer, -- ward number, example: [30, 43]\n community_area_no integer, -- community area number, example: [21, 7]\n fbi_code_no text, -- fbi code number, example: ['01A', '15']\n latitude text, -- example: ['41.94456125', '41.92972657']\n PRIMARY KEY (report_no),\n CONSTRAINT fk_crime_iucr_no FOREIGN KEY (iucr_no) REFERENCES IUCR (iucr_no),\n CONSTRAINT fk_crime_district_no FOREIGN KEY (district_no) REFERENCES District (district_no),\n CONSTRAINT fk_crime_ward_no FOREIGN KEY (ward_no) REFERENCES Ward (ward_no),\n CONSTRAINT fk_crime_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no),\n CONSTRAINT fk_crime_fbi_code_no FOREIGN KEY (fbi_code_no) REFERENCES FBI_Code (fbi_code_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Riverdale', 'Albany Park', 'Altgeld Gardens']\n community_area_no integer, -- community area number, example: [14, 54]\n PRIMARY KEY (neighborhood_name),\n CONSTRAINT fk_neighborhood_community_area_no FOREIGN KEY (community_area_no) REFERENCES Community_Area (community_area_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Daniel', 'Brian']\n ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\n ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\n Population integer, -- example: [56149, 55805]\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Riverdale', 'Rogers Park', 'West Ridge']\n population text, -- example: ['54,991', '71,942']\n PRIMARY KEY (community_area_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncrime against property refers to crime_against = 'Property'; Riverdale refers to community_area_name = 'Riverdale'\nList the report number of crimes against property happened in Riverdale.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }