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 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 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 fax text, -- example: ['312-745-3694', '312-747-5396']\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: ['JB107731', 'JB100159', 'JB100522']\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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase JB107731 refers to case_number = 'JB107731'\nWhat is the district address associated with the case JB107731?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.address FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T2.case_number = 'JB107731'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T1.address FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T2.case_number = 'JB107731'",
"index": 4100,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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 fax text, -- example: ['312-745-3694', '312-747-5396']\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: ['JB107731', 'JB100159', 'JB100522']\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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase JB107731 refers to case_number = 'JB107731'\nWhat is the district address associated with the case JB107731?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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: ['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 crime_against text, -- example: ['Society', '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 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:\ncrime against society refers to crime_against = 'Society'; in June 2018 refers to date LIKE '6/%/2018%'\nList the case number of crimes against society that happened in June 2018.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.case_number FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no WHERE T2.date LIKE '6/%/2018%' AND T1.crime_against = 'Society'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.case_number FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no WHERE T2.date LIKE '6/%/2018%' AND T1.crime_against = 'Society'",
"index": 4101,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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: ['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 crime_against text, -- example: ['Society', '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 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:\ncrime against society refers to crime_against = 'Society'; in June 2018 refers to date LIKE '6/%/2018%'\nList the case number of crimes against society that happened in June 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 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: ['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 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 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 Ward (\n ward_no integer, -- example: [1, 2]\n city_hall_office_room integer, -- example: [200, 305]\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 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 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 highest population refers to max(population); domestic violence refers to domestic = 'TRUE'; percentage = divide(count(domestic = 'TRUE'), count(domestic)) where population = max(population) * 100%\nAmong the crimes located in the community area with the highest population, what is the percentage 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 CAST(COUNT(CASE WHEN T2.domestic = 'TRUE' THEN T2.domestic END) AS REAL) * 100 / COUNT(T2.domestic) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no GROUP BY T1.community_area_no HAVING COUNT(T1.population) ORDER BY COUNT(T1.population) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.domestic = 'TRUE' THEN T2.domestic END) AS REAL) * 100 / COUNT(T2.domestic) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no GROUP BY T1.community_area_no HAVING COUNT(T1.population) ORDER BY COUNT(T1.population) DESC LIMIT 1",
"index": 4102,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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 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 Ward (\n ward_no integer, -- example: [1, 2]\n city_hall_office_room integer, -- example: [200, 305]\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 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 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 highest population refers to max(population); domestic violence refers to domestic = 'TRUE'; percentage = divide(count(domestic = 'TRUE'), count(domestic)) where population = max(population) * 100%\nAmong the crimes located in the community area with the highest population, what is the percentage 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 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 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);\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 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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\narea name refers to community_area_name; the Far north side refers to side = 'Far North'; a population of more than 50000 but less than 70000 refers to population BETWEEN '50000' AND '70000'\nPlease list the area name of the communities in the Far north side, which has a population of more than 50000 but less than 70000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, side FROM Community_Area WHERE side = 'Far North ' AND population BETWEEN 50000 AND 70000",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT community_area_name, side FROM Community_Area WHERE side = 'Far North ' AND population BETWEEN 50000 AND 70000",
"index": 4103,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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 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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\narea name refers to community_area_name; the Far north side refers to side = 'Far North'; a population of more than 50000 but less than 70000 refers to population BETWEEN '50000' AND '70000'\nPlease list the area name of the communities in the Far north side, which has a population of more than 50000 but less than 70000.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (iucr_no)\n);\n\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 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: ['ALLEY', '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 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 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_fax text, -- example: ['312.448.8829', '773.536.7296']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinate refers to latitude, longitude; alley refers to location_description = 'ALLEY'; an arrest was made refers to arrest = 'TRUE'\nGive the coordinate of the alleys where a crime was reported and an arrest was made.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT latitude, longitude FROM Crime WHERE location_description = 'ALLEY' AND arrest = 'TRUE' GROUP BY latitude, longitude",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT latitude, longitude FROM Crime WHERE location_description = 'ALLEY' AND arrest = 'TRUE' GROUP BY latitude, longitude",
"index": 4104,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (iucr_no)\n);\n\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 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: ['ALLEY', '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 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 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_fax text, -- example: ['312.448.8829', '773.536.7296']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncoordinate refers to latitude, longitude; alley refers to location_description = 'ALLEY'; an arrest was made refers to arrest = 'TRUE'\nGive the coordinate of the alleys where a crime was reported and an arrest was made.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\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: ['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 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 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 PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Ogden', '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 PRIMARY KEY (district_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommander's name refers to commander; email address refers to email; phone number refers to phone\nFind the commander's name, email address, and phone number of the Ogden 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, email, phone FROM District WHERE district_name = 'Ogden'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT commander, email, phone FROM District WHERE district_name = 'Ogden'",
"index": 4105,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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 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 PRIMARY KEY (fbi_code_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Ogden', '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 PRIMARY KEY (district_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommander's name refers to commander; email address refers to email; phone number refers to phone\nFind the commander's name, email address, and phone number of the Ogden 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 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 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_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\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 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 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 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 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 side text, -- example: ['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 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:\naverage = Divide(Count(ward_no), Count(side))\nOn average, how many community areas are there in a 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 CAST(COUNT(T1.ward_no) AS REAL) / COUNT(DISTINCT T3.side) 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",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(COUNT(T1.ward_no) AS REAL) / COUNT(DISTINCT T3.side) 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",
"index": 4106,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\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 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 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 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 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 side text, -- example: ['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 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:\naverage = Divide(Count(ward_no), Count(side))\nOn average, how many community areas are there in a 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 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 location_description text, -- example: ['STREET', '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 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_zip text, -- example: ['60647', '60622']\n city_hall_office_room integer, -- example: [200, 305]\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 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 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 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:\nreported on the street refers to location_description = 'STREET'; community area with highest number of crime refers to Max(Count(location_description)); community area refers to community_area_no\nWhich community area has the highest number of crimes reported on the street?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.community_area_no FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T2.location_description = 'STREET' GROUP BY T1.community_area_no ORDER BY COUNT(T2.location_description) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T2.location_description = 'STREET' GROUP BY T1.community_area_no ORDER BY COUNT(T2.location_description) DESC LIMIT 1",
"index": 4107,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 location_description text, -- example: ['STREET', '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 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_zip text, -- example: ['60647', '60622']\n city_hall_office_room integer, -- example: [200, 305]\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 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 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 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:\nreported on the street refers to location_description = 'STREET'; community area with highest number of crime refers to Max(Count(location_description)); community area refers to community_area_no\nWhich community area has the highest number of crimes reported on the street?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\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 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 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 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 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 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 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 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: ['RECKLESS HOMICIDE', 'FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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:\n\"RECKLESS HOMICIDE\" is the secondary_description; average = Divide (Count(report_no), Count(district_name))\nWhat is the average number of reckless homicides that happened in a 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 CAST(COUNT(T2.report_no) AS REAL) / COUNT(DISTINCT T1.district_name) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T2.iucr_no WHERE T3.secondary_description = 'RECKLESS HOMICIDE'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(COUNT(T2.report_no) AS REAL) / COUNT(DISTINCT T1.district_name) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T2.iucr_no WHERE T3.secondary_description = 'RECKLESS HOMICIDE'",
"index": 4108,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\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 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 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 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 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 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 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 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: ['RECKLESS HOMICIDE', 'FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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:\n\"RECKLESS HOMICIDE\" is the secondary_description; average = Divide (Count(report_no), Count(district_name))\nWhat is the average number of reckless homicides that happened in a 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 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 PRIMARY KEY (fbi_code_no)\n);\n\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 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 PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\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 iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\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 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: ['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:\nleast number of domestic crime refers to Min(Count(domestic = \"TRUE\")); community area refers to community_area_no\nFind the community area where the least number of domestic crimes happened.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.community_area_no FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.domestic = 'TRUE' GROUP BY T2.community_area_no ORDER BY COUNT(T2.community_area_no) ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.community_area_no FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.domestic = 'TRUE' GROUP BY T2.community_area_no ORDER BY COUNT(T2.community_area_no) ASC LIMIT 1",
"index": 4109,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 PRIMARY KEY (fbi_code_no)\n);\n\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 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 PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\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 iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\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 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: ['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:\nleast number of domestic crime refers to Min(Count(domestic = \"TRUE\")); community area refers to community_area_no\nFind the community area where the least number of domestic crimes happened.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 District (\n district_no integer, -- district number, example: [1, 2]\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 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 index_code text, -- example: ['N', 'I']\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:\nday in February of 2018 refers to date LIKE '2/%/2018'; less severe crime refers to index_code = 'N'; average = Divide (Count(case_number), 28)\nWhat is the average number of less severe crimes reported a day in February of 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 CAST(COUNT(T2.case_number) AS REAL) / 28 FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no WHERE T2.date LIKE '2/%/2018%' AND T1.index_code = 'N'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(COUNT(T2.case_number) AS REAL) / 28 FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no WHERE T2.date LIKE '2/%/2018%' AND T1.index_code = 'N'",
"index": 4110,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 District (\n district_no integer, -- district number, example: [1, 2]\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 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 index_code text, -- example: ['N', 'I']\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:\nday in February of 2018 refers to date LIKE '2/%/2018'; less severe crime refers to index_code = 'N'; average = Divide (Count(case_number), 28)\nWhat is the average number of less severe crimes reported a day in February of 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: ['SOLICIT FOR PROSTITUTE', '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_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_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 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 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 `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 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);\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 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:\n\"SOLICIT FOR PROSTITUTE\" is the secondary_description; more than average refers to count(iucr_no) > Divide (Count(secondary_description = 'SOLICIT FOR PROSTITUTE'), Count(iucr_no)); name of community refers to community_area_name\nList the name and population of the communities where more than average solicit for prostitutes were reported.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.community_area_name, T2.population FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T1.iucr_no WHERE T3.iucr_no = ( SELECT iucr_no FROM IUCR WHERE secondary_description = 'SOLICIT FOR PROSTITUTE' GROUP BY iucr_no HAVING COUNT(iucr_no) > ( SELECT SUM(CASE WHEN secondary_description = 'SOLICIT FOR PROSTITUTE' THEN 1.0 ELSE 0 END) / COUNT(iucr_no) AS average FROM IUCR ) )",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.community_area_name, T2.population FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T1.iucr_no WHERE T3.iucr_no = ( SELECT iucr_no FROM IUCR WHERE secondary_description = 'SOLICIT FOR PROSTITUTE' GROUP BY iucr_no HAVING COUNT(iucr_no) > ( SELECT SUM(CASE WHEN secondary_description = 'SOLICIT FOR PROSTITUTE' THEN 1.0 ELSE 0 END) / COUNT(iucr_no) AS average FROM IUCR ) )",
"index": 4111,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['SOLICIT FOR PROSTITUTE', '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_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_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 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 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 `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 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);\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 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:\n\"SOLICIT FOR PROSTITUTE\" is the secondary_description; more than average refers to count(iucr_no) > Divide (Count(secondary_description = 'SOLICIT FOR PROSTITUTE'), Count(iucr_no)); name of community refers to community_area_name\nList the name and population of the communities where more than average solicit for prostitutes were reported.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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 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 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 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 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 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 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: ['Harrison', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n phone text, -- example: ['312-745-4290', '312-747-8366']\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:\n\"Harrison\" is the district_name; 'Disorderly Conduct' is the title; percentage = Divide (Count(title = 'Disorderly Conduct'), Count(report_no)) * 100; incident report refers to report_no\nAmong the incidents reported in Harrison, what percentage are 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 COUNT(CASE WHEN T3.title = 'Disorderly Conduct' THEN T2.report_no END) * 100.0 / COUNT(T2.report_no) AS per FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN FBI_Code AS T3 ON T3.fbi_code_no = T2.fbi_code_no WHERE T1.district_name = 'Harrison'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT COUNT(CASE WHEN T3.title = 'Disorderly Conduct' THEN T2.report_no END) * 100.0 / COUNT(T2.report_no) AS per FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN FBI_Code AS T3 ON T3.fbi_code_no = T2.fbi_code_no WHERE T1.district_name = 'Harrison'",
"index": 4112,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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 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 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 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 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 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 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: ['Harrison', 'Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n phone text, -- example: ['312-745-4290', '312-747-8366']\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:\n\"Harrison\" is the district_name; 'Disorderly Conduct' is the title; percentage = Divide (Count(title = 'Disorderly Conduct'), Count(report_no)) * 100; incident report refers to report_no\nAmong the incidents reported in Harrison, what percentage are 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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['AGGRAVATED VEHICULAR HIJACKING', 'VEHICULAR HIJACKING', 'AGGRAVATED', '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 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 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: ['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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"VEHICULAR HIJACKING\" and \"AGGRAVATED VEHICULAR HIJACKING\" are both secondary_description; difference in average = Subtract (Divide(Count(secondary_description = 'VEHICULAR HIJACKING'), Count(district_name)), Divide(Count(secondary_description = \"AGGRAVATED VEHICULAR HIJACKING\"), Count(district_name)))\nCalculate the difference in the average number of vehicular hijackings and aggravated vehicular hijackings in the districts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ROUND(CAST(COUNT(CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL) - CAST(COUNT(CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL), 4) AS \"difference\" FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT ROUND(CAST(COUNT(CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL) - CAST(COUNT(CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL), 4) AS \"difference\" FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no",
"index": 4113,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 secondary_description text, -- example: ['AGGRAVATED VEHICULAR HIJACKING', 'VEHICULAR HIJACKING', 'AGGRAVATED', '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 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 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: ['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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"VEHICULAR HIJACKING\" and \"AGGRAVATED VEHICULAR HIJACKING\" are both secondary_description; difference in average = Subtract (Divide(Count(secondary_description = 'VEHICULAR HIJACKING'), Count(district_name)), Divide(Count(secondary_description = \"AGGRAVATED VEHICULAR HIJACKING\"), Count(district_name)))\nCalculate the difference in the average number of vehicular hijackings and aggravated vehicular hijackings in the districts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['NARCOTICS', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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 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:\nnarcotic type refers to primary_description = 'NARCOTICS'; crime refers to secondary_description\nList all the crimes of the narcotic type that exist.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT secondary_description FROM IUCR WHERE primary_description = 'NARCOTICS' GROUP BY secondary_description",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT secondary_description FROM IUCR WHERE primary_description = 'NARCOTICS' GROUP BY secondary_description",
"index": 4114,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 city_hall_office_phone text, -- example: ['312.744.6836', '312.744.8734']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['NARCOTICS', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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 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:\nnarcotic type refers to primary_description = 'NARCOTICS'; crime refers to secondary_description\nList all the crimes of the narcotic type that exist.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\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 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 Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Hermosa', '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 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 `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 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 fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Hermosa', '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:\n\"Hermosa\" is the neighborhood_name\nHow many different types of crimes, according to the primary description, have occurred in the Hermosa neighborhood?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T4.neighborhood_name = 'Hermosa' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T4 ON T4.community_area_no = T3.community_area_no",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T4.neighborhood_name = 'Hermosa' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T4 ON T4.community_area_no = T3.community_area_no",
"index": 4115,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\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 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 Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Hermosa', '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 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 `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 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 fax text, -- example: ['312-745-3694', '312-747-5396']\n twitter text, -- example: ['\\xa0ChicagoCAPS01', '\\xa0ChicagoCAPS02']\n PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Hermosa', '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:\n\"Hermosa\" is the neighborhood_name\nHow many different types of crimes, according to the primary description, have occurred in the Hermosa neighborhood?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['INTIMIDATION', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['INTIMIDATION', 'FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore intimidation-type crime refers to Max(Count(primary_description = 'INTIMIDATION')); district refers to district_name\nIn which district have there been more intimidation-type crimes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.district_name FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.primary_description = 'INTIMIDATION' GROUP BY T3.district_name ORDER BY COUNT(T1.primary_description) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T3.district_name FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.primary_description = 'INTIMIDATION' GROUP BY T3.district_name ORDER BY COUNT(T1.primary_description) DESC LIMIT 1",
"index": 4116,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n primary_description text, -- example: ['INTIMIDATION', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['INTIMIDATION', 'FIRST DEGREE MURDER', 'SECOND DEGREE MURDER']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore intimidation-type crime refers to Max(Count(primary_description = 'INTIMIDATION')); district refers to district_name\nIn which district have there been more intimidation-type crimes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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 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_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 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 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 `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: ['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 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:\n\"North Lawndale' is the community_area_name; occur the most domestic crime refers to Max(Count(domestic = 'TRUE'))\nWhat types of domestic crimes have occurred the most in the 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 T2.domestic FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'North Lawndale' AND T2.domestic = 'TRUE' GROUP BY T2.domestic ORDER BY COUNT(T2.domestic) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.domestic FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'North Lawndale' AND T2.domestic = 'TRUE' GROUP BY T2.domestic ORDER BY COUNT(T2.domestic) DESC LIMIT 1",
"index": 4117,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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 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_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 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 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 `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: ['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 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:\n\"North Lawndale' is the community_area_name; occur the most domestic crime refers to Max(Count(domestic = 'TRUE'))\nWhat types of domestic crimes have occurred the most in the 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 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 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);\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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\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 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 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 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 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: ['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:\nmore cases of criminal sexual abuse refers to Max(Count(secondary_description = 'CRIMINAL SEXUAL ABUSE'))\nWhich commander has had to deal with more cases of 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 T3.commander FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.secondary_description = 'CRIMINAL SEXUAL ABUSE' GROUP BY T3.commander ORDER BY COUNT(T1.secondary_description) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T3.commander FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.secondary_description = 'CRIMINAL SEXUAL ABUSE' GROUP BY T3.commander ORDER BY COUNT(T1.secondary_description) DESC LIMIT 1",
"index": 4118,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\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 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 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 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 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: ['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:\nmore cases of criminal sexual abuse refers to Max(Count(secondary_description = 'CRIMINAL SEXUAL ABUSE'))\nWhich commander has had to deal with more cases of 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 district_name text, -- example: ['Jefferson 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 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: ['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 Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Jefferson Park', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (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 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 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 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: ['Jefferson 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon domestic crime refers to domestic = 'FALSE'; 'Jefferson Park' is the district_name; percentage = Divide (Count (case_number where domestic = 'FALSE'), Count(case_number)) * 100\nWhat percentage of non-domestic crimes have occurred in the Jefferson 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 CAST(COUNT(CASE WHEN T2.domestic = 'FALSE' THEN T2.case_number END) AS REAL) * 100 / COUNT(T2.case_number) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T1.district_name = 'Jefferson Park'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.domestic = 'FALSE' THEN T2.case_number END) AS REAL) * 100 / COUNT(T2.case_number) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T1.district_name = 'Jefferson Park'",
"index": 4119,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Jefferson 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 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: ['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 Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n community_area_name text, -- example: ['Jefferson Park', 'Rogers Park', 'West Ridge']\n side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (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 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 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 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: ['Jefferson 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnon domestic crime refers to domestic = 'FALSE'; 'Jefferson Park' is the district_name; percentage = Divide (Count (case_number where domestic = 'FALSE'), Count(case_number)) * 100\nWhat percentage of non-domestic crimes have occurred in the Jefferson 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 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_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_fax text, -- example: ['312.744.6712', '312.744.7738']\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 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 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 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 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 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 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:\ndistrict refers to district_name\nHow many districts are there in the police district building with a zip code of 60608?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(*) AS cnt FROM District WHERE zip_code = 60608",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT COUNT(*) AS cnt FROM District WHERE zip_code = 60608",
"index": 4120,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_fax text, -- example: ['312.744.6712', '312.744.7738']\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 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 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 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 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 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 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:\ndistrict refers to district_name\nHow many districts are there in the police district building with a zip code of 60608?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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: ['Rogers Park', 'West Ridge']\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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\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: ['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 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 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 zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n fax text, -- example: ['312-745-3694', '312-747-5396']\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:\n\"Criminal Sexual Abuse\" is the title of crime\nWho is the crime against 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 crime_against FROM FBI_Code WHERE title = 'Criminal Sexual Abuse'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT crime_against FROM FBI_Code WHERE title = 'Criminal Sexual Abuse'",
"index": 4121,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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: ['Rogers Park', 'West Ridge']\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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\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: ['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 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 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 zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n fax text, -- example: ['312-745-3694', '312-747-5396']\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:\n\"Criminal Sexual Abuse\" is the title of crime\nWho is the crime against 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 Community_Area (\n community_area_no integer, -- community area number, example: [1, 2]\n PRIMARY KEY (community_area_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 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 PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\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 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: ['AIRCRAFT', '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 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_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 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:\nin aircraft refers to location_description = 'AIRCRAFT'; general description refers to primary_description; specific description refers to secondary_description; most common crime incidents refers to Max(Count(iucr_no))\nWhat are the general and specific descriptions of the most common crime incidents that happened in an aircraft?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.primary_description, T2.secondary_description FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.location_description = 'AIRCRAFT' GROUP BY T1.iucr_no ORDER BY COUNT(T1.iucr_no) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.primary_description, T2.secondary_description FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.location_description = 'AIRCRAFT' GROUP BY T1.iucr_no ORDER BY COUNT(T1.iucr_no) DESC LIMIT 1",
"index": 4122,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (iucr_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\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 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: ['AIRCRAFT', '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 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_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 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:\nin aircraft refers to location_description = 'AIRCRAFT'; general description refers to primary_description; specific description refers to secondary_description; most common crime incidents refers to Max(Count(iucr_no))\nWhat are the general and specific descriptions of the most common crime incidents that happened in an aircraft?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 primary_description text, -- example: ['BURGLARY', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FORCIBLE ENTRY', '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 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 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: ['DAY CARE CENTER', '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_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_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 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: ['Burglary', '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:\n\"BURGLARY\" is the primary_description; 'FORCIBLE ENTRY' is the secondary_description; 'DAY CARE CENTER' is the location_description; arrests have been made refers to arrest = 'TRUE'\nHow many arrests have been made due to forcible entry burglary that took place in a day care center?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.location_description = 'DAY CARE CENTER' AND T1.secondary_description = 'FORCIBLE ENTRY' AND T1.primary_description = 'BURGLARY'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.location_description = 'DAY CARE CENTER' AND T1.secondary_description = 'FORCIBLE ENTRY' AND T1.primary_description = 'BURGLARY'",
"index": 4123,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 primary_description text, -- example: ['BURGLARY', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\n secondary_description text, -- example: ['FORCIBLE ENTRY', '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 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 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: ['DAY CARE CENTER', '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_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_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 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: ['Burglary', '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:\n\"BURGLARY\" is the primary_description; 'FORCIBLE ENTRY' is the secondary_description; 'DAY CARE CENTER' is the location_description; arrests have been made refers to arrest = 'TRUE'\nHow many arrests have been made due to forcible entry burglary that took place in a day care center?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 `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 District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Englewood', '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 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: ['Englewood', '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: ['Englewood', '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: ['Society', '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:\n\"Englewood\" is the community_area_name; 'Society' is the crime_against\nHow many crime against society were reported in Englewood?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.community_area_name = 'Englewood' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.crime_against = 'Society'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T3.community_area_name = 'Englewood' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.crime_against = 'Society'",
"index": 4124,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 `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 District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Englewood', '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 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: ['Englewood', '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: ['Englewood', '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: ['Society', '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:\n\"Englewood\" is the community_area_name; 'Society' is the crime_against\nHow many crime against society were reported in Englewood?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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: ['Fraud', '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_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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfraud incident refers to title = 'Fraud'; reported in January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; description of location refers to location_description; weekly average refers to Divide (Count(report_no), 4); majority of incidents occurred refers to Max(Count(location_description))\nWhat is the weekly average number of fraud incidents that were reported in January 2018? Provide the description of the location where the majority of fraud incidents occurred in the said month.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.fbi_code_no) AS REAL) / 4 FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(COUNT(T1.fbi_code_no) AS REAL) / 4 FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018'",
"index": 4125,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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: ['Fraud', '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_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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfraud incident refers to title = 'Fraud'; reported in January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; description of location refers to location_description; weekly average refers to Divide (Count(report_no), 4); majority of incidents occurred refers to Max(Count(location_description))\nWhat is the weekly average number of fraud incidents that were reported in January 2018? Provide the description of the location where the majority of fraud incidents occurred in the said month.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 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 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 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 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 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 side refers to side = 'Central'; community refers to community_area_name\nWhat are the communities that are grouped together on the central 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 community_area_name FROM Community_Area WHERE side = 'Central'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT community_area_name FROM Community_Area WHERE side = 'Central'",
"index": 4126,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 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 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 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 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 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 side refers to side = 'Central'; community refers to community_area_name\nWhat are the communities that are grouped together on the central 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_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 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: ['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 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: ['South ', 'North ', 'Far 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 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 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 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 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:\npopulation of more than 30000 refers to Population > 30000; 'North' and 'South' both are the side; different number of community refers to Subtract(Count(Community_area_no where side = 'South'), Count(Community_area_no where side = 'North'))\nWhat is the difference between the number of communities that are located on the north and south sides with a population of more than 30,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 side = 'South ' THEN 1 ELSE 0 END) - SUM(CASE WHEN side = 'North' THEN 1 ELSE 0 END) AS DIFF FROM Community_Area WHERE population > 300000",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN side = 'South ' THEN 1 ELSE 0 END) - SUM(CASE WHEN side = 'North' THEN 1 ELSE 0 END) AS DIFF FROM Community_Area WHERE population > 300000",
"index": 4127,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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 tty text, -- example: ['312-745-3693', '312-747-6656']\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: ['South ', 'North ', 'Far 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 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 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 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 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:\npopulation of more than 30000 refers to Population > 30000; 'North' and 'South' both are the side; different number of community refers to Subtract(Count(Community_area_no where side = 'South'), Count(Community_area_no where side = 'North'))\nWhat is the difference between the number of communities that are located on the north and south sides with a population of more than 30,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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\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 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 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 ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Near West', 'Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Near West\" is the district_name; all contact information refers to phone, fax, tty, twitter\nPlease list all of the contact information for the police district Near West.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT phone, fax, tty, twitter FROM District WHERE district_name = 'Near West'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT phone, fax, tty, twitter FROM District WHERE district_name = 'Near West'",
"index": 4128,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 ward_office_phone text, -- example: ['872.206.2685', '312.643.2299']\n PRIMARY KEY (ward_no)\n);\n\nCREATE TABLE District (\n district_no integer, -- district number, example: [1, 2]\n district_name text, -- example: ['Near West', 'Central', 'Wentworth']\n zip_code integer, -- example: [60616, 60609]\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: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Near West\" is the district_name; all contact information refers to phone, fax, tty, twitter\nPlease list all of the contact information for the police district Near West.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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: ['ASSAULT', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\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 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 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 commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\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:\nrelated to sexual assault refers to primary_description = 'CRIME SEXUAL ASSAULT'; severe case refers to index_code = 'I'; percentage = Divide (Count (iucr_no where primary_description = 'CRIME SEXUAL ASSAULT'), Count (iucr_no)) * 100\nWhat is the percentage of severe cases that are related to sexual assault?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 primary_description = 'CRIM SEXUAL ASSAULT' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM IUCR WHERE index_code = 'I'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN primary_description = 'CRIM SEXUAL ASSAULT' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM IUCR WHERE index_code = 'I'",
"index": 4129,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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 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: ['ASSAULT', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\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 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 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 commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\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:\nrelated to sexual assault refers to primary_description = 'CRIME SEXUAL ASSAULT'; severe case refers to index_code = 'I'; percentage = Divide (Count (iucr_no where primary_description = 'CRIME SEXUAL ASSAULT'), Count (iucr_no)) * 100\nWhat is the percentage of severe cases that are related to sexual assault?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 Neighborhood (\n neighborhood_name text, -- example: ['North Center', '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 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 `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 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 ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\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 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 Center', '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:\n\"North Center\" is the community_area_name; neighborhoods refers to neighborhood_name\nWhat are the neighborhoods that are located in the North Center community 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 T2.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.community_area_name = 'North Center'",
"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.community_area_name = 'North Center'",
"index": 4130,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 Neighborhood (\n neighborhood_name text, -- example: ['North Center', '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 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 `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 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 ward_office_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\n ward_office_zip text, -- example: ['60647', '60622']\n ward_office_fax text, -- example: ['312.448.8829', '773.536.7296']\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 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 Center', '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:\n\"North Center\" is the community_area_name; neighborhoods refers to neighborhood_name\nWhat are the neighborhoods that are located in the North Center community 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 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 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 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 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 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: ['Forest Glen', '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: ['Forest Glen', '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 `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 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:\n\"Forest Glen\" is the community_area_name; neighborhoods refers to neighborhood_name\nHow many neighborhoods can be found in the Forest Glen community 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 SUM(CASE WHEN T2.community_area_name = 'Forest Glen' THEN 1 ELSE 0 END) FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.community_area_name = 'Forest Glen' THEN 1 ELSE 0 END) FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no",
"index": 4131,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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: ['Forest Glen', '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: ['Forest Glen', '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 `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 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:\n\"Forest Glen\" is the community_area_name; neighborhoods refers to neighborhood_name\nHow many neighborhoods can be found in the Forest Glen community 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 FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Criminal Sexual Assault', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\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 side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (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 ward_office_zip text, -- example: ['60647', '60622']\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 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: ['ASSAULT', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\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 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 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 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:\n\"Criminal Sexual Assault\" is the title of crime; against person refers to crime_against = 'Persons'; criminals have been arrested refers to arrest = 'TRUE'; cases refers to case_number\nPlease list any three criminal sexual assault cases against persons where the criminals have been arrested.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.title = 'Criminal Sexual Assault' AND T2.arrest = 'TRUE' AND T1.crime_against = 'Persons' LIMIT 3",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.case_number FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.title = 'Criminal Sexual Assault' AND T2.arrest = 'TRUE' AND T1.crime_against = 'Persons' LIMIT 3",
"index": 4132,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Criminal Sexual Assault', 'Homicide 1st & 2nd Degree', 'Involuntary Manslaughter']\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 side text, -- example: ['Far North ', 'North ']\n PRIMARY KEY (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 ward_office_zip text, -- example: ['60647', '60622']\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 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: ['ASSAULT', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\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 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 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 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:\n\"Criminal Sexual Assault\" is the title of crime; against person refers to crime_against = 'Persons'; criminals have been arrested refers to arrest = 'TRUE'; cases refers to case_number\nPlease list any three criminal sexual assault cases against persons where the criminals have been arrested.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 case_number text, -- example: ['JB120039', '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 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 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: ['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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmultiple homicide refers to Count(case_number) > 1; district refers to district_name\nAt which district did the multiple homicide case number JB120039 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 T1.district_no, T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB120039' GROUP BY T1.district_no, T1.district_name",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T1.district_no, T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB120039' GROUP BY T1.district_no, T1.district_name",
"index": 4133,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 case_number text, -- example: ['JB120039', '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 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 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: ['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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmultiple homicide refers to Count(case_number) > 1; district refers to district_name\nAt which district did the multiple homicide case number JB120039 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 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: ['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 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 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 PRIMARY KEY (district_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 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 FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Drug 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 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_name_suffix text, -- example: ['Jr.']\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 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:\n\"Drug Abuse\" is the title of crime; happened on the street refers to location_description = 'STREET'; percentage = Divide (Count(fbi_code_no where location_description = 'STREET'), Count(fbi_code_no)) * 100\nWhat is the percentage of crime cases that have been classified as \"drug abuse\" by the FBI and happened on the street?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title = 'Drug Abuse' AND T1.location_description = 'STREET' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.fbi_code_no) FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.title = 'Drug Abuse' AND T1.location_description = 'STREET' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.fbi_code_no) FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no",
"index": 4134,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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 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 PRIMARY KEY (district_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 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 FBI_Code (\n fbi_code_no text, -- fbi code number, example: ['01A', '01B']\n title text, -- example: ['Drug 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 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_name_suffix text, -- example: ['Jr.']\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 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:\n\"Drug Abuse\" is the title of crime; happened on the street refers to location_description = 'STREET'; percentage = Divide (Count(fbi_code_no where location_description = 'STREET'), Count(fbi_code_no)) * 100\nWhat is the percentage of crime cases that have been classified as \"drug abuse\" by the FBI and happened on the street?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_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 PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\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 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);\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:\nhighest population refers to Max(Population); ward number refers to ward_no\nProvide the ward number with the highest 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 ward_no FROM Ward ORDER BY Population DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT ward_no FROM Ward ORDER BY Population DESC LIMIT 1",
"index": 4135,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 IUCR (\n iucr_no text, -- iucr number, example: ['031A', '031B']\n PRIMARY KEY (iucr_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 PRIMARY KEY (district_no)\n);\n\nCREATE TABLE Ward (\n ward_no integer, -- example: [1, 2]\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\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 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);\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:\nhighest population refers to Max(Population); ward number refers to ward_no\nProvide the ward number with the highest 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 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 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 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: ['JB112212', '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 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 commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n tty text, -- example: ['312-745-3693', '312-747-6656']\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_zip text, -- example: ['60647', '60622']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase JB112212 refers to case_number = 'JB112212'\nWhat is the beat and location description of the case JB112212?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT beat, location_description FROM Crime WHERE case_number = 'JB112212'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT beat, location_description FROM Crime WHERE case_number = 'JB112212'",
"index": 4136,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['JB112212', '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 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 commander text, -- example: ['Jake M. Alderden', 'Joshua Wallace']\n tty text, -- example: ['312-745-3693', '312-747-6656']\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_zip text, -- example: ['60647', '60622']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncase JB112212 refers to case_number = 'JB112212'\nWhat is the beat and location description of the case JB112212?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 location_description text, -- example: ['OFFICE', 'AUTO', 'APARTMENT']\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 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 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 address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\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_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\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 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: ['Montclare', 'Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Montclare', '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:\n\"Montclare\" is the community_area_name\nProvide at least 5 ward office addresses associated with the crimes that happened in the community of Montclare.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ward_office_address FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Ward AS T3 ON T2.ward_no = T3.ward_no WHERE T1.community_area_name = 'Montclare' GROUP BY T3.ward_office_address LIMIT 5",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T3.ward_office_address FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Ward AS T3 ON T2.ward_no = T3.ward_no WHERE T1.community_area_name = 'Montclare' GROUP BY T3.ward_office_address LIMIT 5",
"index": 4137,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 location_description text, -- example: ['OFFICE', 'AUTO', 'APARTMENT']\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 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 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 address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\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_address text, -- example: ['1958 N. Milwaukee Ave.', '1400 N. Ashland']\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 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: ['Montclare', 'Rogers Park', 'West Ridge']\n PRIMARY KEY (community_area_no)\n);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Montclare', '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:\n\"Montclare\" is the community_area_name\nProvide at least 5 ward office addresses associated with the crimes that happened in the community of Montclare.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneighborhood refers to neighborhood_name; '23778' is the report_no\nName the neighborhood of the community area in crime with report number 23843?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.neighborhood_name FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T3 ON T2.community_area_no = T3.community_area_no WHERE T2.report_no = 23778",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T3.neighborhood_name FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T3 ON T2.community_area_no = T3.community_area_no WHERE T2.report_no = 23778",
"index": 4138,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nneighborhood refers to neighborhood_name; '23778' is the report_no\nName the neighborhood of the community area in crime with report number 23843?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jill M. Stevens', '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 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 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 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 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 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 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:\nreport number refers report_no; 'Jill M. Stevens\" is the commander\nList down the report number of crimes associated with the district commander named Jill M. Stevens.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.commander = 'Jill M. Stevens' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.commander = 'Jill M. Stevens' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no",
"index": 4139,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['Central', 'Wentworth']\n address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n commander text, -- example: ['Jill M. Stevens', '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 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 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 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 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 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 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:\nreport number refers report_no; 'Jill M. Stevens\" is the commander\nList down the report number of crimes associated with the district commander named Jill M. Stevens.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Avalon 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 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 case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['HOUSE', '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 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_name_suffix text, -- example: ['Jr.']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Avalon Park\" is the neghborhood_name; happened inside the house refers to location_description = 'HOUSE'; percentage = Divide (Count(location_description = 'HOUSE'), Count(location_description)) * 100\nAmong the crimes happened in the neighborhood called \"Avalon Park\", what is the percentage of crimes that happened inside the house?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.location_description = 'HOUSE' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.location_description) AS persent FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T3 ON T2.community_area_no = T3.community_area_no WHERE T3.neighborhood_name = 'Avalon Park'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.location_description = 'HOUSE' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.location_description) AS persent FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T3 ON T2.community_area_no = T3.community_area_no WHERE T3.neighborhood_name = 'Avalon Park'",
"index": 4140,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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);\n\nCREATE TABLE Neighborhood (\n neighborhood_name text, -- example: ['Avalon 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 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 case_number text, -- example: ['JB100159', 'JB100522']\n iucr_no text, -- Illinois Uniform Crime Reporting number, example: ['110', '143B']\n location_description text, -- example: ['HOUSE', '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 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_name_suffix text, -- example: ['Jr.']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Avalon Park\" is the neghborhood_name; happened inside the house refers to location_description = 'HOUSE'; percentage = Divide (Count(location_description = 'HOUSE'), Count(location_description)) * 100\nAmong the crimes happened in the neighborhood called \"Avalon Park\", what is the percentage of crimes that happened inside the house?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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);\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 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_fax text, -- example: ['312.448.8829', '773.536.7296']\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 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 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:\nfull name of alderman refers to alderman_first_name, alderman_last_name, alderman_name_suffix\nWhat is the full name of the alderman of ward no.21?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT alderman_first_name, alderman_last_name, alderman_name_suffix FROM Ward WHERE ward_no = 21",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT alderman_first_name, alderman_last_name, alderman_name_suffix FROM Ward WHERE ward_no = 21",
"index": 4141,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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);\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 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_fax text, -- example: ['312.448.8829', '773.536.7296']\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 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 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:\nfull name of alderman refers to alderman_first_name, alderman_last_name, alderman_name_suffix\nWhat is the full name of the alderman of ward no.21?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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_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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsevere refers to index_code = 'I'; incidents refers to iucr_no\nHow many incidents are considered \"severe\" in the IUCR classification?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 IUCR WHERE index_code = 'I'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT COUNT(*) FROM IUCR WHERE index_code = 'I'",
"index": 4142,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 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_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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsevere refers to index_code = 'I'; incidents refers to iucr_no\nHow many incidents are considered \"severe\" in the IUCR classification?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 side text, -- example: ['Far North ', 'North ']\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 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);\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 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:\nin January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; ward with the most number of crime refers to Max (Count(ward_no)); full name refers to alderman_first_name, alderman_last_name, alderman_name_suffix\nWhich alderman represents the ward with the most number of crimes in January, 2018? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.ward_no, T1.alderman_first_name, T1.alderman_last_name, T1.alderman_name_suffix FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' GROUP BY T1.ward_no ORDER BY COUNT(T1.ward_no) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T1.ward_no, T1.alderman_first_name, T1.alderman_last_name, T1.alderman_name_suffix FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' GROUP BY T1.ward_no ORDER BY COUNT(T1.ward_no) DESC LIMIT 1",
"index": 4143,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 side text, -- example: ['Far North ', 'North ']\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 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);\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 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:\nin January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; ward with the most number of crime refers to Max (Count(ward_no)); full name refers to alderman_first_name, alderman_last_name, alderman_name_suffix\nWhich alderman represents the ward with the most number of crimes in January, 2018? Please give his or her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 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 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 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 Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Sophia', 'Pat', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Dowell', 'King', 'La Spata', 'Hopkins']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\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:\nJanuary, 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; had more incidents refers to Max(Count(ward_no))\nThe ward represented by which alderman had more incidents in January, 2018, Pat Dowell or Sophia King?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, COUNT(T1.ward_no) AS num FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE (SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' AND T1.alderman_first_name = 'Pat' AND T1.alderman_last_name = 'Dowell') OR (T1.alderman_first_name = 'Sophia' AND T1.alderman_last_name = 'King') GROUP BY T1.ward_no",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T1.alderman_first_name, T1.alderman_last_name, COUNT(T1.ward_no) AS num FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE (SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' AND T1.alderman_first_name = 'Pat' AND T1.alderman_last_name = 'Dowell') OR (T1.alderman_first_name = 'Sophia' AND T1.alderman_last_name = 'King') GROUP BY T1.ward_no",
"index": 4144,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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 Ward (\n ward_no integer, -- example: [1, 2]\n alderman_first_name text, -- example: ['Sophia', 'Pat', 'Daniel', 'Brian']\n alderman_last_name text, -- example: ['Dowell', 'King', 'La Spata', 'Hopkins']\n ward_email text, -- example: ['info@the1stward.com', 'ward02@cityofchicago.org']\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:\nJanuary, 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; had more incidents refers to Max(Count(ward_no))\nThe ward represented by which alderman had more incidents in January, 2018, Pat Dowell or Sophia King?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 tty text, -- example: ['312-745-3693', '312-747-6656']\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 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 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: ['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 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 side text, -- example: ['Far North ', 'North ']\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_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 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: ['BATTERY', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeneral description refers to primary_description; 'BATTERY' is the primary_description; do not have arrest made refers to arrest = 'FALSE'\nAmong the incidents with the generic description of \"BATTERY\" in the IUCR classification, how many of them do not have arrests made?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T2.arrest = 'FALSE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.primary_description = 'BATTERY'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.arrest = 'FALSE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.primary_description = 'BATTERY'",
"index": 4145,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 tty text, -- example: ['312-745-3693', '312-747-6656']\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 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 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: ['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 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 side text, -- example: ['Far North ', 'North ']\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_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 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: ['BATTERY', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngeneral description refers to primary_description; 'BATTERY' is the primary_description; do not have arrest made refers to arrest = 'FALSE'\nAmong the incidents with the generic description of \"BATTERY\" in the IUCR classification, how many of them do not have arrests made?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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_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_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);\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Homicide 1st & 2nd Degree\" is the title\nPlease list the case numbers of all the crimes whose short description of the kind of crime is \"Homicide 1st & 2nd Degree\" in the FBI classification.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.title = 'Homicide 1st & 2nd Degree'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT T2.case_number FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.title = 'Homicide 1st & 2nd Degree'",
"index": 4146,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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_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_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);\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Homicide 1st & 2nd Degree\" is the title\nPlease list the case numbers of all the crimes whose short description of the kind of crime is \"Homicide 1st & 2nd Degree\" in the FBI classification.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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_first_name text, -- example: ['Daniel', 'Brian']\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 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 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 email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\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: ['Property', 'Persons']\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 January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; against property refers to crime_against = 'Property'\nAmong the incidents in January, 2018, how many of them were stated \"against Property\" in the FBI classification?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 SUBSTR(T2.date, 5, 4) = '2018' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.crime_against = 'Property' AND SUBSTR(T2.date, 1, 1) = '1'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN SUBSTR(T2.date, 5, 4) = '2018' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.crime_against = 'Property' AND SUBSTR(T2.date, 1, 1) = '1'",
"index": 4147,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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_first_name text, -- example: ['Daniel', 'Brian']\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 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 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 email text, -- example: ['\\xa0CAPS001District@chicagopolice.org', '\\xa0CAPS002District@chicagopolice.org']\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: ['Property', 'Persons']\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 January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; against property refers to crime_against = 'Property'\nAmong the incidents in January, 2018, how many of them were stated \"against Property\" in the FBI classification?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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: ['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: ['Robert A. Rubio', '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_name_suffix text, -- example: ['Jr.']\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 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:\nin January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'\nDistrict commander Robert A. Rubio was responsible for how many incidents 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 SUBSTR(T2.date, 5, 4) = '2018' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.commander = 'Robert A. Rubio' AND SUBSTR(T2.date, 1, 1) = '1'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN SUBSTR(T2.date, 5, 4) = '2018' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.commander = 'Robert A. Rubio' AND SUBSTR(T2.date, 1, 1) = '1'",
"index": 4148,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 `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 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: ['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: ['Robert A. Rubio', '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_name_suffix text, -- example: ['Jr.']\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 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:\nin January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'\nDistrict commander Robert A. Rubio was responsible for how many incidents 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 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 `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 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 address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Robert A. Rubio', 'Glenn White', '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 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_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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; 'Robert A. Rubio' and 'Glenn White' are both commander; responsible for more incident refers to Max(count(ward_no))\nWhich district commander was responsible for more incidents in January, 2018, Robert A. Rubio or Glenn White?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 WHERE T1.commander IN ('Robert A. Rubio', 'Glenn White') AND SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' GROUP BY T1.commander",
"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 WHERE T1.commander IN ('Robert A. Rubio', 'Glenn White') AND SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' GROUP BY T1.commander",
"index": 4149,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 address text, -- example: ['1718 South State Street', '5101 South Wentworh Avenue']\n zip_code integer, -- example: [60616, 60609]\n commander text, -- example: ['Robert A. Rubio', 'Glenn White', '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 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_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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; 'Robert A. Rubio' and 'Glenn White' are both commander; responsible for more incident refers to Max(count(ward_no))\nWhich district commander was responsible for more incidents in January, 2018, Robert A. Rubio or Glenn White?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 side text, -- example: ['Far North ', 'North ']\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: ['BATTERY', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\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 `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 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 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:\nincident with no arrest made refers to arrest = 'FALSE'; general description refers to primary_description; \"BATTERY\" is the primary_description; percentage = Divide (Count(iucr_no where primary_description = 'BATTERY'), Count(iucr_no)) * 100\nAmong all the incidents with no arrest made, what is the percentage of them having a generic description of \"BATTERY\" in the IUCR classification?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.primary_description = 'BATTERY' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*)FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.arrest = 'FALSE'",
"style": "rule"
} | {
"db_id": "chicago_crime.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.primary_description = 'BATTERY' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*)FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.arrest = 'FALSE'",
"index": 4150,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 side text, -- example: ['Far North ', 'North ']\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: ['BATTERY', 'HOMICIDE', 'CRIM SEXUAL ASSAULT']\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 `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 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 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:\nincident with no arrest made refers to arrest = 'FALSE'; general description refers to primary_description; \"BATTERY\" is the primary_description; percentage = Divide (Count(iucr_no where primary_description = 'BATTERY'), Count(iucr_no)) * 100\nAmong all the incidents with no arrest made, what is the percentage of them having a generic description of \"BATTERY\" in the IUCR classification?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['California', 'Ca', 'ca', 'CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurants' owners in California refer to owner_state = 'CA';\nHow many restaurants' owners are in California?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(owner_state) FROM businesses WHERE owner_state = 'CA'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(owner_state) FROM businesses WHERE owner_state = 'CA'",
"index": 4151,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['California', 'Ca', 'ca', 'CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurants' owners in California refer to owner_state = 'CA';\nHow many restaurants' owners are in California?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspections carried out in 2016 refer to YEAR(date) = 2016; routine inspections refer to type = 'Routine - Unscheduled';\nAmong the inspections carried out in 2016, how many of them are routine?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(`date`) FROM inspections WHERE STRFTIME('%Y', `date`) = '2016' AND type = 'Routine - Unscheduled'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(`date`) FROM inspections WHERE STRFTIME('%Y', `date`) = '2016' AND type = 'Routine - Unscheduled'",
"index": 4152,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspections carried out in 2016 refer to YEAR(date) = 2016; routine inspections refer to type = 'Routine - Unscheduled';\nAmong the inspections carried out in 2016, how many of them are routine?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['san francisco', 'SAN FRANCISCO', 'San francisco', 'San Francisco', 'S.F.', 'Sf']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspected in 2016 refers to YEAR(date) = 2016; San Francisco refers to city in ('San Francisco', 'SF' ,'S.F.', 'SAN FRANCISCO');\nAmong the restaurants being inspected in 2016, how many of them are in San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T2.city IN ('San Francisco', 'SAN FRANCISCO', 'SF', 'S.F.')",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T2.city IN ('San Francisco', 'SAN FRANCISCO', 'SF', 'S.F.')",
"index": 4153,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['san francisco', 'SAN FRANCISCO', 'San francisco', 'San Francisco', 'S.F.', 'Sf']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspected in 2016 refers to YEAR(date) = 2016; San Francisco refers to city in ('San Francisco', 'SF' ,'S.F.', 'SAN FRANCISCO');\nAmong the restaurants being inspected in 2016, how many of them are in San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-07-29']\n violation_type_id text, -- example: ['103129', '103144']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2014-01-14', '2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; inspection on 2014/1/14 refers to date = '2014-01-14';\nWhat was the type of inspection Tiramisu Kitchen had on 2014/1/14?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen'",
"index": 4154,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-07-29']\n violation_type_id text, -- example: ['103129', '103144']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2014-01-14', '2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; inspection on 2014/1/14 refers to date = '2014-01-14';\nWhat was the type of inspection Tiramisu Kitchen had on 2014/1/14?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; routine inspections refer to type = 'Routine - Unscheduled';\nHow many routine inspections did Tiramisu Kitchen have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.type = 'Routine - Unscheduled' AND T2.name = 'Tiramisu Kitchen'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(T1.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.type = 'Routine - Unscheduled' AND T2.name = 'Tiramisu Kitchen'",
"index": 4155,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; routine inspections refer to type = 'Routine - Unscheduled';\nHow many routine inspections did Tiramisu Kitchen 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 inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n tax_code text, -- example: ['H24', 'H01']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; routine inspections refer to type = 'Routine - Unscheduled'; score of over 70 refers to score > 70;\nAmong the routine inspections of Tiramisu Kitchen, how many of them have a score of over 70?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.type = 'Routine - Unscheduled' AND T1.score > 70",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.type = 'Routine - Unscheduled' AND T1.score > 70",
"index": 4156,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n tax_code text, -- example: ['H24', 'H01']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; routine inspections refer to type = 'Routine - Unscheduled'; score of over 70 refers to score > 70;\nAmong the routine inspections of Tiramisu Kitchen, how many of them have a score of over 70?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['san francisco', 'SAN FRANCISCO', 'San francisco', 'San Francisco', 'S.F.', 'Sf']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurants in San Francisco refer to business_id where city in ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO'); high risk violations refer to risk_category = 'High Risk';\nHow many high risk violations do the restaurants in San Francisco have in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.city IN ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO') AND T1.risk_category = 'High Risk'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.city IN ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO') AND T1.risk_category = 'High Risk'",
"index": 4157,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['san francisco', 'SAN FRANCISCO', 'San francisco', 'San Francisco', 'S.F.', 'Sf']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurants in San Francisco refer to business_id where city in ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO'); high risk violations refer to risk_category = 'High Risk';\nHow many high risk violations do the restaurants in San Francisco have in total?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\navg(score);\nWhat is the average scores of Tiramisu Kitchen in all inspections?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen'",
"index": 4158,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\navg(score);\nWhat is the average scores of Tiramisu Kitchen in all inspections?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Low Risk', 'Moderate Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most number of the low risk violations refers to MAX(COUNT(business_id)) where risk_category = 'Low Risk' ;\nGive the address of the business with the most number of the low risk violations.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.address FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk' GROUP BY T2.address ORDER BY COUNT(T1.business_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.address FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk' GROUP BY T2.address ORDER BY COUNT(T1.business_id) DESC LIMIT 1",
"index": 4159,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Low Risk', 'Moderate Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most number of the low risk violations refers to MAX(COUNT(business_id)) where risk_category = 'Low Risk' ;\nGive the address of the business with the most number of the low risk violations.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Low Risk', 'Moderate Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlow risk violation because of \"Permit license or inspection report not posted\" refers to risk_category = 'Low Risk' where description = 'Permit license or inspection report not posted'; business was the first one refers to name where MIN(date);\nWhich business was the first one to get a low risk violation because of \"Permit license or inspection report not posted\"? Give the name of the business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = ( SELECT MIN(`date`) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Permit license or inspection report not posted' ) AND T1.risk_category = 'Low Risk' AND T1.description = 'Permit license or inspection report not posted'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = ( SELECT MIN(`date`) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Permit license or inspection report not posted' ) AND T1.risk_category = 'Low Risk' AND T1.description = 'Permit license or inspection report not posted'",
"index": 4160,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Low Risk', 'Moderate Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlow risk violation because of \"Permit license or inspection report not posted\" refers to risk_category = 'Low Risk' where description = 'Permit license or inspection report not posted'; business was the first one refers to name where MIN(date);\nWhich business was the first one to get a low risk violation because of \"Permit license or inspection report not posted\"? Give the name of the business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Chairman Bao', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(score where type = 'Routine - Unscheduled' and name = 'Chairman Bao'), COUNT(type = 'Routine - Unscheduled' where name = 'Chairman Bao'));\nWhat is the average score for \"Chairman Bao\" in all its unscheduled routine inspections?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.name = 'Chairman Bao' THEN T1.score ELSE 0 END) AS REAL) / COUNT(CASE WHEN T1.type = 'Routine - Unscheduled' THEN T1.score ELSE 0 END) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.name = 'Chairman Bao' THEN T1.score ELSE 0 END) AS REAL) / COUNT(CASE WHEN T1.type = 'Routine - Unscheduled' THEN T1.score ELSE 0 END) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id",
"index": 4161,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Chairman Bao', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(SUM(score where type = 'Routine - Unscheduled' and name = 'Chairman Bao'), COUNT(type = 'Routine - Unscheduled' where name = 'Chairman Bao'));\nWhat is the average score for \"Chairman Bao\" in all its unscheduled routine inspections?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Melody Lounge', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(risk_category = 'Moderate Risk' where name = 'Melody Lounge'), COUNT(business_id where name = 'Melody Lounge')) as percentage;\nWhat percentage of the violations for \"Melody Lounge\" are moderate risks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.risk_category = 'Moderate Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM businesses AS T1 INNER JOIN violations AS T2 ON T1.business_id = T2.business_id WHERE T1.name = 'Melody Lounge'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.risk_category = 'Moderate Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM businesses AS T1 INNER JOIN violations AS T2 ON T1.business_id = T2.business_id WHERE T1.name = 'Melody Lounge'",
"index": 4162,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Melody Lounge', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(risk_category = 'Moderate Risk' where name = 'Melody Lounge'), COUNT(business_id where name = 'Melody Lounge')) as percentage;\nWhat percentage of the violations for \"Melody Lounge\" are moderate risks?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['HAYWARD', 'San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['Hayward', 'San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries in Hayward refer city = 'HAYWARD';\nHow many eateries are located in Hayward?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM businesses WHERE city = 'HAYWARD'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM businesses WHERE city = 'HAYWARD'",
"index": 4163,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['HAYWARD', 'San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['Hayward', 'San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries in Hayward refer city = 'HAYWARD';\nHow many eateries are located in Hayward?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishments have the same meaning as businesses; inspection score of no more than 50 refers to score < 50;\nHow many establishments have an inspection score of no more than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT business_id) FROM inspections WHERE score < 50",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT business_id) FROM inspections WHERE score < 50",
"index": 4164,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishments have the same meaning as businesses; inspection score of no more than 50 refers to score < 50;\nHow many establishments have an inspection score of no more than 50?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2012-01-01', '2012-01-09', '2012-01-06', '2012-01-05', '2012-01-04', '2012-01-03']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries applied in 2012 refer to business_id where application_date between '2012-01-01' and '2012-12-31';\nHow many eateries applied in 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(business_id) FROM businesses WHERE STRFTIME('%Y', application_date) = '2012'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM businesses WHERE STRFTIME('%Y', application_date) = '2012'",
"index": 4165,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2012-01-01', '2012-01-09', '2012-01-06', '2012-01-05', '2012-01-04', '2012-01-03']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries applied in 2012 refer to business_id where application_date between '2012-01-01' and '2012-12-31';\nHow many eateries applied in 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest health and safety hazards refer to risk_category = 'High Risk'; year(date) = 2016; establishments has the same meaning as businesses;\nIn 2016, which city has the highest number of establishments with the highest health and safety hazards?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.city FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T1.risk_category = 'High Risk' GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.city FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T1.risk_category = 'High Risk' GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1",
"index": 4166,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest health and safety hazards refer to risk_category = 'High Risk'; year(date) = 2016; establishments has the same meaning as businesses;\nIn 2016, which city has the highest number of establishments with the highest health and safety hazards?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe lowest inspection score refers to MIN(score);\nWhat is the name of the establishment with the lowest inspection score of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = ( SELECT MIN(score) FROM inspections )",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = ( SELECT MIN(score) FROM inspections )",
"index": 4167,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe lowest inspection score refers to MIN(score);\nWhat is the name of the establishment with the lowest inspection score of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; high risks violations refer to risk_category = 'High Risk';\nHow many high risks violations did the Tiramisu Kitchen violate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'High Risk'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'High Risk'",
"index": 4168,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nTiramisu Kitchen is the name of the business; high risks violations refer to risk_category = 'High Risk';\nHow many high risks violations did the Tiramisu Kitchen violate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Complaint', 'Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishments with the tax code H24 refer to business_id where tax_code = 'H24'; complaint inspections of 5 or more refer to inspections where type = 'Complaint' and COUNT(business_id) ≥ 5;\nHow many establishments with the tax code H24 have complaint inspections of 5 or more?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ( SELECT T1.business_id FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.tax_code = 'H24' AND T1.type = 'Complaint' GROUP BY T1.business_id HAVING COUNT(T1.business_id) > 5 ) T3",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ( SELECT T1.business_id FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.tax_code = 'H24' AND T1.type = 'Complaint' GROUP BY T1.business_id HAVING COUNT(T1.business_id) > 5 ) T3",
"index": 4169,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Complaint', 'Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishments with the tax code H24 refer to business_id where tax_code = 'H24'; complaint inspections of 5 or more refer to inspections where type = 'Complaint' and COUNT(business_id) ≥ 5;\nHow many establishments with the tax code H24 have complaint inspections of 5 or more?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Contaminated or adulterated food', 'Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishments have the same meaning as businesses; contaminated or adulterated food refers to violations where description = 'Contaminated or adulterated food'; date = '2013';\nIn 2013, what are the names of the establishments with contaminated or adulterated food?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2013' AND T1.description = 'Contaminated or adulterated food'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2013' AND T1.description = 'Contaminated or adulterated food'",
"index": 4170,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Contaminated or adulterated food', 'Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishments have the same meaning as businesses; contaminated or adulterated food refers to violations where description = 'Contaminated or adulterated food'; date = '2013';\nIn 2013, what are the names of the establishments with contaminated or adulterated food?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage score refers avg(score); owner with the highest number of establishments refers to owner_name where MAX(COUNT(business_id));\nWhat is the average score of the establishments owned by the owner with the highest number of establishments?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T2.business_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T2.business_id) DESC LIMIT 1",
"index": 4171,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage score refers avg(score); owner with the highest number of establishments refers to owner_name where MAX(COUNT(business_id));\nWhat is the average score of the establishments owned by the owner with the highest number of establishments?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishment refers to business_id; the highest number of inspections refers to MAX(COUNT(business_id)); avg(score);\nWhich establishment has the highest number of inspections done? Give the name of the establishment and calculate for its average score per inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.name ORDER BY COUNT(T2.business_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.name, AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.name ORDER BY COUNT(T2.business_id) DESC LIMIT 1",
"index": 4172,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishment refers to business_id; the highest number of inspections refers to MAX(COUNT(business_id)); avg(score);\nWhich establishment has the highest number of inspections done? Give the name of the establishment and calculate for its average score per inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries got highest inspection score in 2013 refer to business_id from inspections where score = 100 and year(date) = 2013;\nHow many eateries got highest inspection in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT business_id) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' AND score = ( SELECT MAX(score) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' )",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT business_id) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' AND score = ( SELECT MAX(score) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' )",
"index": 4173,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries got highest inspection score in 2013 refer to business_id from inspections where score = 100 and year(date) = 2013;\nHow many eateries got highest inspection in 2013?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['ID', 'CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Structural Inspection', 'Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries' IDs refer to business_id; structural inspection type refers to inspections WHERE type = 'Structural Inspection'; in February 2016 refers to year(date) = 2016 and month(date) = 2;\nList down the eateries' IDs with structural inspection type in February 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT business_id FROM inspections WHERE type = 'Structural Inspection' AND `date` LIKE '2016-02%'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT business_id FROM inspections WHERE type = 'Structural Inspection' AND `date` LIKE '2016-02%'",
"index": 4174,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['ID', 'CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Structural Inspection', 'Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries' IDs refer to business_id; structural inspection type refers to inspections WHERE type = 'Structural Inspection'; in February 2016 refers to year(date) = 2016 and month(date) = 2;\nList down the eateries' IDs with structural inspection type in February 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: [\"ART'S CAFE\", 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nART's CAFÉ is the name of the business; moderate risk category refers to risk_category = 'Moderate Risk';\nDescribe the inspection types and violation descriptions under moderate risk category for ART's CAFÉ.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.type, T1.description FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'ART''S CAFÉ' AND T1.risk_category = 'Moderate Risk'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T2.type, T1.description FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'ART''S CAFÉ' AND T1.risk_category = 'Moderate Risk'",
"index": 4175,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: [\"ART'S CAFE\", 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nART's CAFÉ is the name of the business; moderate risk category refers to risk_category = 'Moderate Risk';\nDescribe the inspection types and violation descriptions under moderate risk category for ART's CAFÉ.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['STARBUCKS', 'Starbucks', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSTARBUCKS is the name of the business; high risk category refers to risk_category = 'High Risk';\nMention the violation type ID and description of high risk category for STARBUCKS.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.violation_type_id, T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'STARBUCKS' AND T1.risk_category = 'High Risk'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T1.violation_type_id, T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'STARBUCKS' AND T1.risk_category = 'High Risk'",
"index": 4176,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['STARBUCKS', 'Starbucks', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSTARBUCKS is the name of the business; high risk category refers to risk_category = 'High Risk';\nMention the violation type ID and description of high risk category for STARBUCKS.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2016-07-30', '2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2016-07-30', '2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries' IDs inspected on 30th July, 2016 refer to business_id where business_id is not null and date = '2016-07-30';\nProvide eateries' IDs, names and addresses which were inspected on 30th July, 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.business_id, T2.name, T2.address FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.date = '2016-07-30'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T2.business_id, T2.name, T2.address FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.date = '2016-07-30'",
"index": 4177,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2016-07-30', '2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2016-07-30', '2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries' IDs inspected on 30th July, 2016 refer to business_id where business_id is not null and date = '2016-07-30';\nProvide eateries' IDs, names and addresses which were inspected on 30th July, 2016.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n phone_number integer, -- example: [14155345060, 14155823535]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries refer to business_id;\nProvide the names, risk categories and descriptions for the eateries with violation type ID of 103111.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.risk_category, T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.violation_type_id = '103111'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.name, T1.risk_category, T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.violation_type_id = '103111'",
"index": 4178,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n phone_number integer, -- example: [14155345060, 14155823535]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries refer to business_id;\nProvide the names, risk categories and descriptions for the eateries with violation type ID of 103111.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['El Aji Peruvian Restaurant', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n latitude real, -- example: [37.7911, 37.7929]\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEl Aji Peruvian Restaurant is the name of the business; highest inspection score refers to MAX(score);\nWhat was the inspection type when El Aji Peruvian Restaurant got highest inspection score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'El Aji Peruvian Restaurant' ORDER BY T1.score DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'El Aji Peruvian Restaurant' ORDER BY T1.score DESC LIMIT 1",
"index": 4179,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['El Aji Peruvian Restaurant', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n latitude real, -- example: [37.7911, 37.7929]\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEl Aji Peruvian Restaurant is the name of the business; highest inspection score refers to MAX(score);\nWhat was the inspection type when El Aji Peruvian Restaurant got highest inspection score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Improper cooking time or temperatures', 'Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nowners of eateries refer to owner_name; highest health hazard by improper cooking time or temperatures refers to risk_category = 'High Risk' and description = 'Improper cooking time or temperatures';\nWho were the owners of eateries which had highest health hazard by improper cooking time or temperatures?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.description = 'Improper cooking time or temperatures'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.description = 'Improper cooking time or temperatures'",
"index": 4180,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Improper cooking time or temperatures', 'Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nowners of eateries refer to owner_name; highest health hazard by improper cooking time or temperatures refers to risk_category = 'High Risk' and description = 'Improper cooking time or temperatures';\nWho were the owners of eateries which had highest health hazard by improper cooking time or temperatures?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2015-02-02', '2015-02-06', '2015-02-05', '2015-02-04', '2015-02-03', '2001-10-10']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2015-02-02', '2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2015-02-02', '2014-01-14', '2014-01-24']\n type text, -- example: ['Reinspection/Followup', 'Routine - Unscheduled']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries which had reinspection on 2nd February, 2015 refer to business_id where date = '2015-02-02' and type = 'Reinspection/Followup';\nList the eateries' names and addresses which had reinspection on 2nd February, 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name, T2.address FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2015-02-02' AND T1.type = 'Reinspection/Followup'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT T2.name, T2.address FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2015-02-02' AND T1.type = 'Reinspection/Followup'",
"index": 4181,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2015-02-02', '2015-02-06', '2015-02-05', '2015-02-04', '2015-02-03', '2001-10-10']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2015-02-02', '2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2015-02-02', '2014-01-14', '2014-01-24']\n type text, -- example: ['Reinspection/Followup', 'Routine - Unscheduled']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\neateries which had reinspection on 2nd February, 2015 refer to business_id where date = '2015-02-02' and type = 'Reinspection/Followup';\nList the eateries' names and addresses which had reinspection on 2nd February, 2015.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['1825 POST St #223', '1825 Post St #215', '033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'San Francisco,']\n postal_code text, -- example: ['94104', '94133']\n phone_number integer, -- example: [14155345060, 14155823535]\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['1825 POST ST.', '33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['san francisco', 'SAN FRANCISCO', 'San francisco', 'San Francisco', 'St', 'S.F.']\n owner_state text, -- example: ['San Francisco', 'CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1825 POST St #223 refers to address = '1825 POST St #223', San Francisco is the name of the city;\nHow many of the businesses are located at 1825 POST St #223, San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(business_id) FROM businesses WHERE address = '1825 POST St #223' AND city = 'SAN FRANCISCO'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM businesses WHERE address = '1825 POST St #223' AND city = 'SAN FRANCISCO'",
"index": 4182,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['1825 POST St #223', '1825 Post St #215', '033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'San Francisco,']\n postal_code text, -- example: ['94104', '94133']\n phone_number integer, -- example: [14155345060, 14155823535]\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['1825 POST ST.', '33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['san francisco', 'SAN FRANCISCO', 'San francisco', 'San Francisco', 'St', 'S.F.']\n owner_state text, -- example: ['San Francisco', 'CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1825 POST St #223 refers to address = '1825 POST St #223', San Francisco is the name of the city;\nHow many of the businesses are located at 1825 POST St #223, San Francisco?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n city text, -- example: ['San Francisco', 'S.F.']\n tax_code text, -- example: ['H24', 'H01']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Low Risk', 'Moderate Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2014 refers to year(date) = 2014; risk_category = 'Low Risk';\nIn the violations in 2014, how many of them have a low risk category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(risk_category) FROM violations WHERE STRFTIME('%Y', `date`) = '2014' AND risk_category = 'Low Risk'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(risk_category) FROM violations WHERE STRFTIME('%Y', `date`) = '2014' AND risk_category = 'Low Risk'",
"index": 4183,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n city text, -- example: ['San Francisco', 'S.F.']\n tax_code text, -- example: ['H24', 'H01']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Low Risk', 'Moderate Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2014 refers to year(date) = 2014; risk_category = 'Low Risk';\nIn the violations in 2014, how many of them have a low risk category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['SAN FRANCISCO MADELEINE, INC.', 'San Francisco Madeleine, Inc', 'Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness owned by San Francisco Madeleine, Inc. refers to business_id where owner_name = 'San Francisco Madeleine, Inc.';\nGive the business ID and risk category of the business owned by San Francisco Madeleine, Inc.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.business_id, T1.risk_category FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_name = 'San Francisco Madeleine, Inc.'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T2.business_id, T1.risk_category FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_name = 'San Francisco Madeleine, Inc.'",
"index": 4184,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['SAN FRANCISCO MADELEINE, INC.', 'San Francisco Madeleine, Inc', 'Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness owned by San Francisco Madeleine, Inc. refers to business_id where owner_name = 'San Francisco Madeleine, Inc.';\nGive the business ID and risk category of the business owned by San Francisco Madeleine, Inc.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusinesses with a high risk category refer to business_id where risk_category = 'High Risk';\nAmong the businesses within the postal code 94117, what is total number of businesses with a high risk category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.postal_code = 94117 AND T1.risk_category = 'High Risk'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.postal_code = 94117 AND T1.risk_category = 'High Risk'",
"index": 4185,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusinesses with a high risk category refer to business_id where risk_category = 'High Risk';\nAmong the businesses within the postal code 94117, what is total number of businesses with a high risk category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Range', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['ID', 'CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusinesses with score that ranges from 70 to 80 refer to business_id where score between 80 and 90;\nAmong the businesses with score that ranges from 70 to 80, list their violation type ID and risk category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.violation_type_id, T1.risk_category FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id INNER JOIN inspections AS T3 ON T2.business_id = T3.business_id WHERE T3.score BETWEEN 70 AND 80",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T1.violation_type_id, T1.risk_category FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id INNER JOIN inspections AS T3 ON T2.business_id = T3.business_id WHERE T3.score BETWEEN 70 AND 80",
"index": 4186,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Range', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n phone_number integer, -- example: [14155345060, 14155823535]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['ID', 'CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusinesses with score that ranges from 70 to 80 refer to business_id where score between 80 and 90;\nAmong the businesses with score that ranges from 70 to 80, list their violation type ID and risk category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Rue Lepic', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n latitude real, -- example: [37.7911, 37.7929]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Rue Lepic\" is the name of the business;\nList the tax code and inspection type of the business named \"Rue Lepic\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.tax_code, T2.type FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'Rue Lepic'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T3.tax_code, T2.type FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'Rue Lepic'",
"index": 4187,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Rue Lepic', 'Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n latitude real, -- example: [37.7911, 37.7929]\n tax_code text, -- example: ['H24', 'H01']\n business_certificate integer, -- example: [779059, 352312]\n application_date date, -- example: ['2001-10-10', '1989-02-01']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Rue Lepic\" is the name of the business;\nList the tax code and inspection type of the business named \"Rue Lepic\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nowner refers to owner_name; high risk violation of 103109 and described as unclean or unsanitary food contact surfaces refers to risk_category = 'High Risk' where violation_type_id = 103109 and description = 'Unclean or unsanitary food contact surfaces';\nWho is the owner of the business that has a high risk violation of 103109 and described as unclean or unsanitary food contact surfaces?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.violation_type_id = 103109 AND T1.description = 'Unclean or unsanitary food contact surfaces'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.violation_type_id = 103109 AND T1.description = 'Unclean or unsanitary food contact surfaces'",
"index": 4188,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n business_certificate integer, -- example: [779059, 352312]\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_address text, -- example: ['33 Belden St', '500 California St, 2nd Floor']\n owner_state text, -- example: ['CA', 'DC']\n owner_zip text, -- example: ['94104', '94133']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n score integer, -- example: [92, 94]\n `date` date, -- example: ['2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['High Risk', 'Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nowner refers to owner_name; high risk violation of 103109 and described as unclean or unsanitary food contact surfaces refers to risk_category = 'High Risk' where violation_type_id = 103109 and description = 'Unclean or unsanitary food contact surfaces';\nWho is the owner of the business that has a high risk violation of 103109 and described as unclean or unsanitary food contact surfaces?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n address text, -- example: ['747 IRVING St', '033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'San Francisco,']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness ID from 30 to 50 refers to business_id between 30 and 50; address = '747 IRVING St'; city = 'San Francisco';\nList the violation type ID of business with business ID from 30 to 50 and located at 747 IRVING St, San Francisco.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.violation_type_id FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.business_id BETWEEN 30 AND 50 AND T2.address = '747 IRVING St' AND T2.city = 'San Francisco'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T1.violation_type_id FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.business_id BETWEEN 30 AND 50 AND T2.address = '747 IRVING St' AND T2.city = 'San Francisco'",
"index": 4189,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n address text, -- example: ['747 IRVING St', '033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['san Francisco', 'SAN FRANCISCO', 'san francisco', 'San Francisco', 'San Francisc', 'San Francisco,']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness ID from 30 to 50 refers to business_id between 30 and 50; address = '747 IRVING St'; city = 'San Francisco';\nList the violation type ID of business with business ID from 30 to 50 and located at 747 IRVING St, San Francisco.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-06-12', '2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2014-06-12', '2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-06-12', '2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness that violates 103156 on June 12, 2014 refers to business_id where violation_type_id = 103156 and date = '2014-06-12';\nWhat is the owner's name of the of the business that violates 103156 on June 12, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.violation_type_id = 103156 AND T1.`date` = '2014-06-12'",
"style": "rule"
} | {
"db_id": "food_inspection.sqlite",
"gt_sql": "SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.violation_type_id = 103156 AND T1.`date` = '2014-06-12'",
"index": 4190,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspections (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-06-12', '2014-01-14', '2014-01-24']\n type text, -- example: ['Routine - Unscheduled', 'Reinspection/Followup']\n CONSTRAINT fk_inspections_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\n\nCREATE TABLE businesses (\n business_id integer, -- example: [10, 24]\n name text, -- example: ['Tiramisu Kitchen', 'OMNI S.F. Hotel - 2nd Floor Pantry']\n address text, -- example: ['033 Belden Pl', '500 California St, 2nd Floor']\n city text, -- example: ['San Francisco', 'S.F.']\n postal_code text, -- example: ['94104', '94133']\n latitude real, -- example: [37.7911, 37.7929]\n longitude real, -- example: [-122.404, -122.403]\n tax_code text, -- example: ['H24', 'H01']\n application_date date, -- example: ['2014-06-12', '2001-10-10', '1989-02-01']\n owner_name text, -- example: ['Tiramisu LLC', 'OMNI San Francisco Hotel Corp']\n owner_city text, -- example: ['San Francisco', 'S.F.']\n owner_state text, -- example: ['CA', 'DC']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE violations (\n business_id integer, -- example: [10, 24]\n `date` date, -- example: ['2014-06-12', '2014-07-29', '2014-01-14']\n violation_type_id text, -- example: ['103129', '103144']\n risk_category text, -- example: ['Moderate Risk', 'Low Risk']\n description text, -- example: ['Insufficient hot water or running water', 'Unapproved or unmaintained equipment or ']\n CONSTRAINT fk_violations_business_id FOREIGN KEY (business_id) REFERENCES businesses (business_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness that violates 103156 on June 12, 2014 refers to business_id where violation_type_id = 103156 and date = '2014-06-12';\nWhat is the owner's name of the of the business that violates 103156 on June 12, 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE beers (\n id integer, -- example: [2687, 2688]\n brewery_id integer, -- example: [0, 1]\n ibu real, -- International Bitterness Units, example: [65.0, 85.0]\n name text, -- example: [\"Dale's Pale Ale\", 'Gordon Ale (2009)']\n style text, -- example: ['American Pale Ale (APA)', 'American Double / Imperial IPA']\n ounces real, -- example: [12.0, 16.0]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE breweries (\n id integer, -- example: [0, 1]\n name text, -- example: ['NorthGate Brewing ', 'Against the Grain Brewery']\n city text, -- example: ['New York', 'York', 'Minneapolis', 'Louisville']\n state text, -- example: ['MN', 'KY']\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:\nThe more IBU, the more bitter the beer is, bitterest means highest IBU.\nWhere in New York can you locate the brewery that makes the bitterest beer? List both the brewery's name and the name of the city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name, T2.city FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.state = 'NY' ORDER BY T1.ibu DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "craftbeer.sqlite",
"gt_sql": "SELECT T2.name, T2.city FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.state = 'NY' ORDER BY T1.ibu DESC LIMIT 1",
"index": 4191,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE beers (\n id integer, -- example: [2687, 2688]\n brewery_id integer, -- example: [0, 1]\n ibu real, -- International Bitterness Units, example: [65.0, 85.0]\n name text, -- example: [\"Dale's Pale Ale\", 'Gordon Ale (2009)']\n style text, -- example: ['American Pale Ale (APA)', 'American Double / Imperial IPA']\n ounces real, -- example: [12.0, 16.0]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE breweries (\n id integer, -- example: [0, 1]\n name text, -- example: ['NorthGate Brewing ', 'Against the Grain Brewery']\n city text, -- example: ['New York', 'York', 'Minneapolis', 'Louisville']\n state text, -- example: ['MN', 'KY']\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:\nThe more IBU, the more bitter the beer is, bitterest means highest IBU.\nWhere in New York can you locate the brewery that makes the bitterest beer? List both the brewery's name and the name of the city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE breweries (\n id integer, -- example: [0, 1]\n name text, -- example: ['Boston Beer Company', 'NorthGate Brewing ', 'Against the Grain Brewery']\n state text, -- example: ['MN', 'KY']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE beers (\n id integer, -- example: [2687, 2688]\n brewery_id integer, -- example: [0, 1]\n abv real, -- alcohol by volume, example: [0.065, 0.087]\n ibu real, -- International Bitterness Units, example: [65.0, 85.0]\n name text, -- example: [\"Dale's Pale Ale\", 'Gordon Ale (2009)']\n style text, -- example: ['American Pale Ale (APA)', 'American Double / Imperial IPA']\n ounces real, -- example: [12.0, 16.0]\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:\nWhat is the average alcohol content per 12-ounce beer bottle produced by Boston Beer Company?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T1.abv) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.name = 'Boston Beer Company' AND T1.ounces = 12",
"style": "rule"
} | {
"db_id": "craftbeer.sqlite",
"gt_sql": "SELECT AVG(T1.abv) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T2.name = 'Boston Beer Company' AND T1.ounces = 12",
"index": 4192,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE breweries (\n id integer, -- example: [0, 1]\n name text, -- example: ['Boston Beer Company', 'NorthGate Brewing ', 'Against the Grain Brewery']\n state text, -- example: ['MN', 'KY']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE beers (\n id integer, -- example: [2687, 2688]\n brewery_id integer, -- example: [0, 1]\n abv real, -- alcohol by volume, example: [0.065, 0.087]\n ibu real, -- International Bitterness Units, example: [65.0, 85.0]\n name text, -- example: [\"Dale's Pale Ale\", 'Gordon Ale (2009)']\n style text, -- example: ['American Pale Ale (APA)', 'American Double / Imperial IPA']\n ounces real, -- example: [12.0, 16.0]\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:\nWhat is the average alcohol content per 12-ounce beer bottle produced by Boston Beer Company?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE breweries (\n id integer, -- example: [0, 1]\n name text, -- example: ['NorthGate Brewing ', 'Against the Grain Brewery']\n city text, -- example: ['Minneapolis', 'Louisville']\n state text, -- example: ['AL', 'MN', 'KY']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE beers (\n id integer, -- example: [2687, 2688]\n brewery_id integer, -- example: [0, 1]\n abv real, -- alcohol by volume, example: [0.065, 0.087]\n ibu real, -- International Bitterness Units, example: [65.0, 85.0]\n name text, -- example: ['All American Blonde Ale', \"Dale's Pale Ale\", 'Gordon Ale (2009)']\n style text, -- example: ['American Blonde Ale', 'American Pale Ale (APA)', 'American Double / Imperial IPA']\n ounces real, -- example: [12.0, 16.0]\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:\nPercentage of the state of Wisconsin produces American Blonde Ale could be computed by count(breweries in Wisconsin producing American Blonde Ale) / count(all breweries)\nWhen compared to the total number of breweries in the US producing American Blonde Ale, how many in the state of Wisconsin produces American Blonde Ale? Indicate your answer in percentage (%).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T2.state = 'WI', 1, 0)) AS REAL) * 100 / COUNT(T1.id) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T1.style = 'American Blonde Ale'",
"style": "rule"
} | {
"db_id": "craftbeer.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T2.state = 'WI', 1, 0)) AS REAL) * 100 / COUNT(T1.id) FROM beers AS T1 INNER JOIN breweries AS T2 ON T1.brewery_id = T2.id WHERE T1.style = 'American Blonde Ale'",
"index": 4193,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE breweries (\n id integer, -- example: [0, 1]\n name text, -- example: ['NorthGate Brewing ', 'Against the Grain Brewery']\n city text, -- example: ['Minneapolis', 'Louisville']\n state text, -- example: ['AL', 'MN', 'KY']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE beers (\n id integer, -- example: [2687, 2688]\n brewery_id integer, -- example: [0, 1]\n abv real, -- alcohol by volume, example: [0.065, 0.087]\n ibu real, -- International Bitterness Units, example: [65.0, 85.0]\n name text, -- example: ['All American Blonde Ale', \"Dale's Pale Ale\", 'Gordon Ale (2009)']\n style text, -- example: ['American Blonde Ale', 'American Pale Ale (APA)', 'American Double / Imperial IPA']\n ounces real, -- example: [12.0, 16.0]\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:\nPercentage of the state of Wisconsin produces American Blonde Ale could be computed by count(breweries in Wisconsin producing American Blonde Ale) / count(all breweries)\nWhen compared to the total number of breweries in the US producing American Blonde Ale, how many in the state of Wisconsin produces American Blonde Ale? Indicate your answer in percentage (%).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost likely to gain weight refers to MAX(total_fat)\nWhat is the title of the recipe that is most likely to gain weight?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cookbook.sqlite",
"gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id ORDER BY T2.total_fat DESC LIMIT 1",
"index": 4194,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost likely to gain weight refers to MAX(total_fat)\nWhat is the title of the recipe that is most likely to gain weight?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers to title; unsaturated fat refers to SUBTRACT(total_fat, sat_fat)\nWhat is the unsaturated fat content in the recipe \"Raspberry Chiffon Pie\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.total_fat - T2.sat_fat FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'",
"style": "rule"
} | {
"db_id": "cookbook.sqlite",
"gt_sql": "SELECT T2.total_fat - T2.sat_fat FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Raspberry Chiffon Pie'",
"index": 4195,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n alcohol real, -- example: [0.0, 1.93]\n total_fat real, -- example: [11.53, 1.08]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers to title; unsaturated fat refers to SUBTRACT(total_fat, sat_fat)\nWhat is the unsaturated fat content in the recipe \"Raspberry Chiffon Pie\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['prepared', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 10 minutes to prepare refers to prep_min > 10; the most calories refers to MAX(calories)\nAmong the recipes that take more than 10 minutes to prepare, what is the title of the one with the most calories?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.prep_min > 10 ORDER BY T2.calories DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "cookbook.sqlite",
"gt_sql": "SELECT T1.title FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.prep_min > 10 ORDER BY T2.calories DESC LIMIT 1",
"index": 4196,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n iron real, -- example: [0.81, 0.57]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n preparation text, -- example: ['prepared', 'melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n name text, -- example: ['1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 10 minutes to prepare refers to prep_min > 10; the most calories refers to MAX(calories)\nAmong the recipes that take more than 10 minutes to prepare, what is the title of the one with the most calories?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers to title; do not need preprocessing refers to preparation IS NULL\nPlease list the names of all the ingredients needed for the recipe \"Raspberry Chiffon Pie\" that do not need preprocessing.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Raspberry Chiffon Pie' AND T2.preparation IS NULL",
"style": "rule"
} | {
"db_id": "cookbook.sqlite",
"gt_sql": "SELECT T3.name FROM Recipe AS T1 INNER JOIN Quantity AS T2 ON T1.recipe_id = T2.recipe_id INNER JOIN Ingredient AS T3 ON T3.ingredient_id = T2.ingredient_id WHERE T1.title = 'Raspberry Chiffon Pie' AND T2.preparation IS NULL",
"index": 4197,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['raspberry', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n servings integer, -- example: [10, 4]\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n alcohol real, -- example: [0.0, 1.93]\n sat_fat real, -- saturated fat, example: [2.21, 0.58]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n preparation text, -- example: ['melted', 'or water']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRaspberry Chiffon Pie refers to title; do not need preprocessing refers to preparation IS NULL\nPlease list the names of all the ingredients needed for the recipe \"Raspberry Chiffon Pie\" that do not need preprocessing.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['graham cracker crumbs', 'cracker crumbs', 'graham crackers', 'crackers', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'graham cracker crumbs' is a name of an ingredient\nHow many recipes include the ingredient \"graham cracker crumbs\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = 'graham cracker crumbs'",
"style": "rule"
} | {
"db_id": "cookbook.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Ingredient AS T1 INNER JOIN Quantity AS T2 ON T1.ingredient_id = T2.ingredient_id WHERE T1.name = 'graham cracker crumbs'",
"index": 4198,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n max_qty real, -- maximum quantity, example: [2.0, 0.25]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['graham cracker crumbs', 'cracker crumbs', 'graham crackers', 'crackers', '1% lowfat cottage cheese', '1% lowfat milk']\n plural text, -- example: ['s', '#NAME?']\n PRIMARY KEY (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n servings integer, -- example: [10, 4]\n prep_min integer, -- preparation minute, example: [20, 5]\n cook_min integer, -- cooked minute, example: [8, 2]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n cholestrl real, -- cholesterol, example: [1.39, 3.48]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_carb real, -- percentage calculation carbo, example: [56.8, 67.38]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'graham cracker crumbs' is a name of an ingredient\nHow many recipes include the ingredient \"graham cracker crumbs\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Turkey Tenderloin Bundles', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['turkey tenderloin', 'turkey', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nturkey tenderloin refers to title\nHow many calories does the turkey tenderloin bundles recipe have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.calories FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Turkey Tenderloin Bundles'",
"style": "rule"
} | {
"db_id": "cookbook.sqlite",
"gt_sql": "SELECT T2.calories FROM Recipe AS T1 INNER JOIN Nutrition AS T2 ON T1.recipe_id = T2.recipe_id WHERE T1.title = 'Turkey Tenderloin Bundles'",
"index": 4199,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Nutrition (\n recipe_id integer, -- example: [214, 215]\n protein real, -- example: [5.47, 5.7]\n carbo real, -- example: [41.29, 23.75]\n total_fat real, -- example: [11.53, 1.08]\n sodium real, -- example: [260.78, 46.17]\n iron real, -- example: [0.81, 0.57]\n vitamin_c real, -- example: [8.89, 13.02]\n vitamin_a real, -- example: [586.2, 2738.24]\n fiber real, -- example: [0.87, 0.62]\n pcnt_cal_fat real, -- percentage calculation fat, example: [35.68, 6.89]\n pcnt_cal_prot real, -- percentage calculation protein, example: [7.53, 16.17]\n calories real, -- example: [290.79, 141.01]\n PRIMARY KEY (recipe_id),\n CONSTRAINT fk_nutrition_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id)\n);\n\nCREATE TABLE Quantity (\n quantity_id integer, -- example: [1, 2]\n recipe_id integer, -- example: [214, 215]\n ingredient_id integer, -- example: [1613, 3334]\n min_qty real, -- minimum quantity, example: [2.0, 0.25]\n unit text, -- example: ['cup(s)', 'teaspoon(s)']\n optional text, -- example: ['FALSE', 'TRUE']\n PRIMARY KEY (quantity_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Nutrition (recipe_id),\n CONSTRAINT fk_quantity_recipe_id FOREIGN KEY (recipe_id) REFERENCES Recipe (recipe_id),\n CONSTRAINT fk_quantity_ingredient_id FOREIGN KEY (ingredient_id) REFERENCES Ingredient (ingredient_id)\n);\n\nCREATE TABLE Recipe (\n recipe_id integer, -- example: [214, 215]\n title text, -- example: ['Turkey Tenderloin Bundles', 'Raspberry Chiffon Pie', 'Apricot Yogurt Parfaits']\n subtitle text, -- example: ['with Banana Cream Whip', 'a La Creme']\n yield_unit text, -- example: ['1 pie', '8 tarts']\n prep_min integer, -- preparation minute, example: [20, 5]\n stnd_min integer, -- stand minute, example: [305, 65]\n source text, -- example: ['The California Tree Fruit Agreement', 'Produce for Better Health Foundation and']\n intro text, -- introduction, example: ['Serve in stemmed glasses and top with sl', 'For a quick, low-cal dessert, serve this']\n directions text, -- example: ['For crust, preheat oven to 375 degrees F', 'Drain canned apricots, pour 1/4 cup of t']\n PRIMARY KEY (recipe_id)\n);\n\nCREATE TABLE Ingredient (\n ingredient_id integer, -- example: [1, 6]\n category text, -- example: ['dairy', 'Mexican products']\n name text, -- example: ['turkey tenderloin', 'turkey', '1% lowfat cottage cheese', '1% lowfat milk']\n PRIMARY KEY (ingredient_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nturkey tenderloin refers to title\nHow many calories does the turkey tenderloin bundles recipe 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"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.