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 Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['El Mirage', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow much time does this business open refers to SUBTRACT(closing_time, opening_time); DIVIDE(SUM(SUBTRACT(closing_time, opening_time)), SUM(Business.business_id))\nHow much time do businesses in El Mirage City, AZ State operate in average daily?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.closing_time - T2.opening_time) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'El Mirage' AND T1.state = 'AZ'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT SUM(T2.closing_time - T2.opening_time) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'El Mirage' AND T1.state = 'AZ'",
"index": 2000,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['El Mirage', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow much time does this business open refers to SUBTRACT(closing_time, opening_time); DIVIDE(SUM(SUBTRACT(closing_time, opening_time)), SUM(Business.business_id))\nHow much time do businesses in El Mirage City, AZ State operate in average daily?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['SC', 'AZ']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclosing day refers to SUBTRACT(days.day_id, business_Hours.day_id)\nList down the closing day of businesses located at SC State.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.day_id - T2.day_id FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.state = 'SC'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT T3.day_id - T2.day_id FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.state = 'SC'",
"index": 2001,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['SC', 'AZ']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclosing day refers to SUBTRACT(days.day_id, business_Hours.day_id)\nList down the closing day of businesses located at SC State.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of businesses refers to category_name; stars ratings are 5 refers to stars = 5\nList down the category of businesses whose stars ratings are 5.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T1.stars = 5",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T1.stars = 5",
"index": 2002,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of businesses refers to category_name; stars ratings are 5 refers to stars = 5\nList down the category of businesses whose stars ratings are 5.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Medium', 'None', 'Low']\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_12 text, -- example: ['Medium', 'None', 'Low']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n label_time_14 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser's compliment in photo refers to compliment_type = 'photo'; photo has medium in number refers to number_of_compliments = 'Medium'\nHow many user's compliment in photo has medium in number?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos' AND T2.number_of_compliments = 'Medium'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos' AND T2.number_of_compliments = 'Medium'",
"index": 2003,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Medium', 'None', 'Low']\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_12 text, -- example: ['Medium', 'None', 'Low']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n label_time_14 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser's compliment in photo refers to compliment_type = 'photo'; photo has medium in number refers to number_of_compliments = 'Medium'\nHow many user's compliment in photo has medium in number?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['ambience_romantic', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, 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\"ambience_romantic\" attribute refers to attribute_name = 'ambience_romantic' AND attribute_value = 'true'\nSum up the number of business with \"ambience_romantic\" attribute.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_romantic' AND T2.attribute_value = 'true'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_romantic' AND T2.attribute_value = 'true'",
"index": 2004,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['ambience_romantic', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, 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\"ambience_romantic\" attribute refers to attribute_name = 'ambience_romantic' AND attribute_value = 'true'\nSum up the number of business with \"ambience_romantic\" attribute.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Mesa', 'Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_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 are not closed refers to active = 'true'\nHow many businesses are not closed in the city of Mesa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business WHERE city = 'Mesa' AND active = 'true'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city = 'Mesa' AND active = 'true'",
"index": 2005,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Mesa', 'Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_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 are not closed refers to active = 'true'\nHow many businesses are not closed in the city of Mesa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_4 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstars = 2 means bad experience; stars = 1 means terrible experience; customers had a bad or terrible experience refers to stars = 2 OR stars = 1\nIn how many businesses have customers had a bad or terrible experience?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business WHERE stars IN (1, 2)",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM Business WHERE stars IN (1, 2)",
"index": 2006,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_4 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstars = 2 means bad experience; stars = 1 means terrible experience; customers had a bad or terrible experience refers to stars = 2 OR stars = 1\nIn how many businesses have customers had a bad or terrible experience?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow much time does this business open refers to SUBTRACT(closing_time, opening_time); every day of the week refers to day_id BETWEEN 1 AND 7\nHow many businesses are opened the same number of hours every day of the week?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'",
"index": 2007,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow much time does this business open refers to SUBTRACT(closing_time, opening_time); every day of the week refers to day_id BETWEEN 1 AND 7\nHow many businesses are opened the same number of hours every day of the week?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['High', 'None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['High', 'None', 'Low']\n label_time_11 text, -- example: ['High', 'None', 'Low']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_14 text, -- example: ['High', 'None', 'Low']\n label_time_15 text, -- example: ['High', 'None', 'Low']\n label_time_16 text, -- example: ['High', 'None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have fans refers to user_fans = 'None'; high number of compliment refers to number_of_compliments = 'High'\nHow many of the users who use a high number of compliments do not have any fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id) FROM Users_Compliments AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.number_of_compliments = 'High' AND T2.user_fans = 'None'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.user_id) FROM Users_Compliments AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.number_of_compliments = 'High' AND T2.user_fans = 'None'",
"index": 2008,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['High', 'None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['High', 'None', 'Low']\n label_time_11 text, -- example: ['High', 'None', 'Low']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_14 text, -- example: ['High', 'None', 'Low']\n label_time_15 text, -- example: ['High', 'None', 'Low']\n label_time_16 text, -- example: ['High', 'None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndo not have fans refers to user_fans = 'None'; high number of compliment refers to number_of_compliments = 'High'\nHow many of the users who use a high number of compliments do not have any fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common type of compliments refers to MAX(COUNT(compliment_type))\nWhat is the most common type of compliments that a user has received from other users?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.compliment_type FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id GROUP BY T2.compliment_type ORDER BY COUNT(T2.compliment_type) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT T2.compliment_type FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id GROUP BY T2.compliment_type ORDER BY COUNT(T2.compliment_type) DESC LIMIT 1",
"index": 2009,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common type of compliments refers to MAX(COUNT(compliment_type))\nWhat is the most common type of compliments that a user has received from other users?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['more', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_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 likes mean this tip is more valuable; the most likes refers to MAX(likes); stars refers to users_average_stars\nHow many stars does each of the 3 top users with the most likes in their reviews 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.user_average_stars FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id GROUP BY T2.user_id ORDER BY SUM(T1.likes) DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT T2.user_average_stars FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id GROUP BY T2.user_id ORDER BY SUM(T1.likes) DESC LIMIT 3",
"index": 2010,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['more', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_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 likes mean this tip is more valuable; the most likes refers to MAX(likes); stars refers to users_average_stars\nHow many stars does each of the 3 top users with the most likes in their reviews 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['false', 'true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['music_karaoke', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmusic_karaoke attribute refers to attribute_name = 'music_karaoke' AND attribute_value = 'true'; businesses are closed refers to active = 'false'\nHow many businesses with music_karaoke attribute are closed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'music_karaoke' AND T3.active = 'false' AND T2.attribute_value IN ('none', 'no', 'false')",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'music_karaoke' AND T3.active = 'false' AND T2.attribute_value IN ('none', 'no', 'false')",
"index": 2011,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_cool text, -- example: ['Low', 'Uber']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['false', 'true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['music_karaoke', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmusic_karaoke attribute refers to attribute_name = 'music_karaoke' AND attribute_value = 'true'; businesses are closed refers to active = 'false'\nHow many businesses with music_karaoke attribute are closed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Long', 'Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_14 text, -- example: ['High', 'None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlong tip refers to tip_length = 'Long'; 2 likes refers to likes = 2; high number of fans refers to user_fans = 'High'\nHow many users with a long tip and 2 likes for their tip have a high number of fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.user_id) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T2.tip_length = 'Long' AND T2.likes = 2 AND T1.user_fans = 'High'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.user_id) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T2.tip_length = 'Long' AND T2.likes = 2 AND T1.user_fans = 'High'",
"index": 2012,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Long', 'Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_14 text, -- example: ['High', 'None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlong tip refers to tip_length = 'Long'; 2 likes refers to likes = 2; high number of fans refers to user_fans = 'High'\nHow many users with a long tip and 2 likes for their tip have a high number of fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['12PM', '11AM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_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 that opened on Sunday refers to day_of_week = 'Sunday'; businesses that opened at 12PM refers to opening_time = '12PM'\nHow many businesses in the city of Scottsdale open on Sunday at 12PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business AS T1 INNER JOIN Business_hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Scottsdale' AND T3.day_of_week = 'Sunday' AND T2.opening_time = '12PM'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.business_id) FROM Business AS T1 INNER JOIN Business_hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Scottsdale' AND T3.day_of_week = 'Sunday' AND T2.opening_time = '12PM'",
"index": 2013,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['12PM', '11AM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Scottsdale', 'Phoenix']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_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 that opened on Sunday refers to day_of_week = 'Sunday'; businesses that opened at 12PM refers to opening_time = '12PM'\nHow many businesses in the city of Scottsdale open on Sunday at 12PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Obstetricians & Gynecologists', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nObstetricians & Gynecologists category refers to category_name = 'Obstetricians & Gynecologists'; calculation = AVG(stars)\nWhat is the average number of stars for businesses in the Obstetricians & Gynecologists 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 CAST(SUM(T1.stars) AS REAL) / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Obstetricians & Gynecologists'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(T1.stars) AS REAL) / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Obstetricians & Gynecologists'",
"index": 2014,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Obstetricians & Gynecologists', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nObstetricians & Gynecologists category refers to category_name = 'Obstetricians & Gynecologists'; calculation = AVG(stars)\nWhat is the average number of stars for businesses in the Obstetricians & Gynecologists 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 Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Surprise', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSurprise is a city\nHow many of the businesses are in Surprise?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business WHERE city = 'Surprise'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city = 'Surprise'",
"index": 2015,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Surprise', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSurprise is a city\nHow many of the businesses are in Surprise?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Medium', 'None', 'Low']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n label_time_14 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; AZ is a state; medium review count refers to review_count = 'Medium'\nWhat is the total number of active businesses in AZ with a medium review count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business WHERE review_count = 'Medium' AND state = 'AZ' AND active = 'true'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(business_id) FROM Business WHERE review_count = 'Medium' AND state = 'AZ' AND active = 'true'",
"index": 2016,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['Medium', 'None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Medium', 'None', 'Low']\n label_time_11 text, -- example: ['Medium', 'Low', 'None']\n label_time_13 text, -- example: ['Medium', 'None', 'Low']\n label_time_14 text, -- example: ['Medium', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Medium', 'Low']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses refers to active = 'true'; AZ is a state; medium review count refers to review_count = 'Medium'\nWhat is the total number of active businesses in AZ with a medium review count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Low', 'None']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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:\nusers in yelping since 2009 to 2011 refers to user_yelping_since_year BETWEEN 2009 AND 2011; low count of fans refers to user_fans = 'Low'\nIn users yelping since 2009 to 2011, how many of them have low count of fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(user_id) FROM Users WHERE user_yelping_since_year >= 2009 AND user_yelping_since_year < 2012 AND user_fans = 'Low'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year >= 2009 AND user_yelping_since_year < 2012 AND user_fans = 'Low'",
"index": 2017,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Low', 'None']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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:\nusers in yelping since 2009 to 2011 refers to user_yelping_since_year BETWEEN 2009 AND 2011; low count of fans refers to user_fans = 'Low'\nIn users yelping since 2009 to 2011, how many of them have low count of fans?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreview length refers to review_length; user 11021 refers to user_id = 11021; business ID 3 refers to business_id = 3\nWhat is the review length of user 11021 to business with business ID 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT review_length FROM Reviews WHERE user_id = 11021 AND business_id = 3",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT review_length FROM Reviews WHERE user_id = 11021 AND business_id = 3",
"index": 2018,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreview length refers to review_length; user 11021 refers to user_id = 11021; business ID 3 refers to business_id = 3\nWhat is the review length of user 11021 to business with business ID 3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; category of Food refers to category_name = 'Food'\nList the active business ID and its stars of the businesses fall under the category of 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 DISTINCT T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food' AND T1.active = 'true'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food' AND T1.active = 'true'",
"index": 2019,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['list', 'photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; category of Food refers to category_name = 'Food'\nList the active business ID and its stars of the businesses fall under the category of 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 Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of the business refers to category_name; attributes of the business refers to attribute_name; the highest star rating refers to MAX(stars)\nWhat is the category and attributes of businesses with highest star rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.category_name, T5.attribute_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id INNER JOIN Business_Attributes AS T4 ON T2.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T1.stars = ( SELECT MAX(stars) FROM Business )",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T3.category_name, T5.attribute_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id INNER JOIN Business_Attributes AS T4 ON T2.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T1.stars = ( SELECT MAX(stars) FROM Business )",
"index": 2020,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of the business refers to category_name; attributes of the business refers to attribute_name; the highest star rating refers to MAX(stars)\nWhat is the category and attributes of businesses with highest star rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of the business refers to category_name; short review length refers to review_length = 'Short'; the highest star rating refers to MAX(stars); business ID from 7 to 14 refers to business_id BETWEEN 7 AND 14\nWhat is the category of the business with short review length and highest review stars within business ID from 7 to 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 DISTINCT T3.category_name FROM Reviews AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T2.business_id >= 7 AND T2.business_id < 15 AND T1.review_length = 'Short' AND T1.review_stars = ( SELECT MAX(review_stars) FROM Reviews )",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T3.category_name FROM Reviews AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T2.business_id >= 7 AND T2.business_id < 15 AND T1.review_length = 'Short' AND T1.review_stars = ( SELECT MAX(review_stars) FROM Reviews )",
"index": 2021,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Short', 'Medium']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of the business refers to category_name; short review length refers to review_length = 'Short'; the highest star rating refers to MAX(stars); business ID from 7 to 14 refers to business_id BETWEEN 7 AND 14\nWhat is the category of the business with short review length and highest review stars within business ID from 7 to 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['BYOB', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; category of Food refers to category_name = 'Food'; attribute of BYOB refers to attribute_name = 'BYOB'; high review count refers to review_count = 'High'\nCount the active businesses that has an attribute of BYOB with high review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name = 'BYOB' AND T1.review_count = 'High' AND T1.active = 'true'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name = 'BYOB' AND T1.review_count = 'High' AND T1.active = 'true'",
"index": 2022,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['BYOB', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; category of Food refers to category_name = 'Food'; attribute of BYOB refers to attribute_name = 'BYOB'; high review count refers to review_count = 'High'\nCount the active businesses that has an attribute of BYOB with high review count.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGlendale is a city; the highest star rating refers to MAX(stars)\nWhat is the closing and opening time of businesses located at Glendale with highest star rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.opening_time, T2.closing_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' ORDER BY T1.stars DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT T2.opening_time, T2.closing_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' ORDER BY T1.stars DESC LIMIT 1",
"index": 2023,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nGlendale is a city; the highest star rating refers to MAX(stars)\nWhat is the closing and opening time of businesses located at Glendale with highest star rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; categories refers to category_name; Glendale is a city; AZ is a state\nList the categories of active businesses in Glendale, AZ.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.category_name FROM Business_Categories AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T1.category_id = T3.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T2.city = 'Glendale'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T3.category_name FROM Business_Categories AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T1.category_id = T3.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T2.city = 'Glendale'",
"index": 2024,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; categories refers to category_name; Glendale is a city; AZ is a state\nList the categories of active businesses in Glendale, AZ.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_11 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['7PM', '7AM', '11AM', '12PM']\n closing_time text, -- example: ['7PM', '7AM', '8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Wednesday', 'Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation of business refers to city; business hours from 7am to 7pm refers to opening_time = '7AM' AND closing_time = '7PM'; Wednesday refers to day_of_week = 'Wednesday'\nFind the location of businesses that has business hours from 7 am to 7 pm every Wednesday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time = '7AM' AND T2.closing_time = '7PM' AND T3.day_of_week = 'Wednesday'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time = '7AM' AND T2.closing_time = '7PM' AND T3.day_of_week = 'Wednesday'",
"index": 2025,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_11 text, -- example: ['Low', 'None']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n tip_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['7PM', '7AM', '11AM', '12PM']\n closing_time text, -- example: ['7PM', '7AM', '8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_useful text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Wednesday', 'Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation of business refers to city; business hours from 7am to 7pm refers to opening_time = '7AM' AND closing_time = '7PM'; Wednesday refers to day_of_week = 'Wednesday'\nFind the location of businesses that has business hours from 7 am to 7 pm every Wednesday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['Low', 'None']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Goodyear', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; low review count refers to review_count = 'Low'; 3 stars refers to stars = 3; Goodyear is a city; AZ is a state\nWhat is the attribute value of an active business with a low review count and 3 stars which is located at Goodyear, AZ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.state = 'AZ' AND T1.city = 'Goodyear' AND T1.active = 'true' AND T1.stars = 3 AND T1.review_count = 'Low'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT DISTINCT T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.state = 'AZ' AND T1.city = 'Goodyear' AND T1.active = 'true' AND T1.stars = 3 AND T1.review_count = 'Low'",
"index": 2026,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_1 text, -- example: ['Low', 'None']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Goodyear', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\n review_votes_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\n PRIMARY KEY (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business ID refers to active = 'true'; low review count refers to review_count = 'Low'; 3 stars refers to stars = 3; Goodyear is a city; AZ is a state\nWhat is the attribute value of an active business with a low review count and 3 stars which is located at Goodyear, AZ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of food refers to category_name = 'Food'; calculation = DIVIDE(COUNT(stars > 3), SUM(stars))\nAmong the businesses with a category of Food, what is the percentage of the business with greater than 3 stars?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food'",
"style": "rule"
} | {
"db_id": "public_review_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Food'",
"index": 2027,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Sunday', 'Monday']\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n user_average_stars text, -- example: ['4.0', '2.5']\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Elite (\n user_id integer, -- example: [3, 19]\n year_id integer, -- example: [2010, 2011]\n PRIMARY KEY (user_id, year_id)\n);\n\nCREATE TABLE Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Tips (\n business_id integer, -- example: [2, 3]\n user_id integer, -- example: [12490, 16328]\n likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (business_id)\n);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_2 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_19 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_21 text, -- example: ['None', 'Low']\n label_time_23 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Business_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Users_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Food', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of food refers to category_name = 'Food'; calculation = DIVIDE(COUNT(stars > 3), SUM(stars))\nAmong the businesses with a category of Food, what is the percentage of the business with greater than 3 stars?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_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 cited word refers to max(count(word_cited_id);\nWhat is the most cited word? How many papers was that word cited in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT word_cited_id, COUNT(paper_id) FROM content GROUP BY word_cited_id ORDER BY COUNT(word_cited_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "citeseer.sqlite",
"gt_sql": "SELECT word_cited_id, COUNT(paper_id) FROM content GROUP BY word_cited_id ORDER BY COUNT(word_cited_id) DESC LIMIT 1",
"index": 2028,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_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 cited word refers to max(count(word_cited_id);\nWhat is the most cited word? How many papers was that word cited in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor all words cited in paper ID 315017, state the other paper ID and class label which also cited those words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.class_label, T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.paper_id = 315017",
"style": "rule"
} | {
"db_id": "citeseer.sqlite",
"gt_sql": "SELECT T1.class_label, T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.paper_id = 315017",
"index": 2029,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFor all words cited in paper ID 315017, state the other paper ID and class label which also cited those words.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_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 = (divide(count(word_cited_id where class_label = 'Agents')), (count(word_cited_id)))*100;\nCalculate the percentage of words used in Agents class label.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(DISTINCT CASE WHEN T1.class_label = 'Agents' THEN T2.word_cited_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id",
"style": "rule"
} | {
"db_id": "citeseer.sqlite",
"gt_sql": "SELECT CAST(COUNT(DISTINCT CASE WHEN T1.class_label = 'Agents' THEN T2.word_cited_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id",
"index": 2030,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_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 = (divide(count(word_cited_id where class_label = 'Agents')), (count(word_cited_id)))*100;\nCalculate the percentage of words used in Agents class label.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\n\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['AI', 'Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all words cited in the AI class label.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI'",
"style": "rule"
} | {
"db_id": "citeseer.sqlite",
"gt_sql": "SELECT DISTINCT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI'",
"index": 2031,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\n\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['AI', 'Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all words cited in the AI class label.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['ML', 'Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclass refers to class_label; average = divide(count(paper_id where class_label = 'M')), (count(paper_id)));\nOn average, how many papers are under the ML class?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN class_label = 'ML' THEN paper_id ELSE NULL END) AS REAL) / COUNT(paper_id) FROM paper",
"style": "rule"
} | {
"db_id": "citeseer.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN class_label = 'ML' THEN paper_id ELSE NULL END) AS REAL) / COUNT(paper_id) FROM paper",
"index": 2032,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE paper (\n paper_id text, -- example: ['100157', '100598']\n class_label text, -- example: ['ML', 'Agents', 'IR']\n PRIMARY KEY (paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclass refers to class_label; average = divide(count(paper_id where class_label = 'M')), (count(paper_id)));\nOn average, how many papers are under the ML class?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paper (\n paper_id text, -- example: ['sima01computational', '100157', '100598']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['sima01computational', '100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['sima01computational', '100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npaper cited by refers to citing_paper_id; citing_paper_id = 'sima01computational';\nFind the words cited in papers that are cited by sima01computational?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.word_cited_id FROM cites AS T1 INNER JOIN content AS T2 ON T1.cited_paper_id = T2.paper_id WHERE T1.citing_paper_id = 'sima01computational'",
"style": "rule"
} | {
"db_id": "citeseer.sqlite",
"gt_sql": "SELECT DISTINCT T2.word_cited_id FROM cites AS T1 INNER JOIN content AS T2 ON T1.cited_paper_id = T2.paper_id WHERE T1.citing_paper_id = 'sima01computational'",
"index": 2033,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE paper (\n paper_id text, -- example: ['sima01computational', '100157', '100598']\n PRIMARY KEY (paper_id)\n);\n\nCREATE TABLE content (\n paper_id text, -- example: ['sima01computational', '100157', '100598']\n word_cited_id text, -- example: ['word1163', 'word1509']\n PRIMARY KEY (paper_id, word_cited_id),\n CONSTRAINT fk_content_paper_id FOREIGN KEY (paper_id) REFERENCES paper (paper_id)\n);\n\nCREATE TABLE cites (\n cited_paper_id text, -- example: ['100157', '100598']\n citing_paper_id text, -- example: ['sima01computational', '100157', '364207']\n PRIMARY KEY (cited_paper_id, citing_paper_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npaper cited by refers to citing_paper_id; citing_paper_id = 'sima01computational';\nFind the words cited in papers that are cited by sima01computational?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noldest refers to Min(birthdate)\nWhich crew member of the simpson 20s is the oldest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Person WHERE birthdate IS NOT NULL ORDER BY birthdate ASC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT name FROM Person WHERE birthdate IS NOT NULL ORDER BY birthdate ASC LIMIT 1;",
"index": 2034,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\noldest refers to Min(birthdate)\nWhich crew member of the simpson 20s is the oldest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dan Castellaneta', 'Adam Greeley', 'Adam Klein']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Dan Castellaneta', 'Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Dan Castellaneta\" is the name of Person\nWhat's the nickname for Dan Castellaneta?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT nickname FROM Person WHERE name = 'Dan Castellaneta';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT nickname FROM Person WHERE name = 'Dan Castellaneta';",
"index": 2035,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dan Castellaneta', 'Adam Greeley', 'Adam Klein']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Dan Castellaneta', 'Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Dan Castellaneta\" is the name of Person\nWhat's the nickname for Dan Castellaneta?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['New York City', 'USA', 'Brooklyn']\n birth_region text, -- example: ['New York', 'California']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in New York city refers to birth_region = 'New York'; born after year 1970 refers to ('%Y', birthdate) > 1970\nAmong the crew members of the simpson 20s born in the New York city, how many of them were born after the year 1970?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(name) FROM Person WHERE birth_region = 'New York' AND SUBSTR(birthdate, 1, 4) > '1970';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(name) FROM Person WHERE birth_region = 'New York' AND SUBSTR(birthdate, 1, 4) > '1970';",
"index": 2036,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['New York City', 'USA', 'Brooklyn']\n birth_region text, -- example: ['New York', 'California']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in New York city refers to birth_region = 'New York'; born after year 1970 refers to ('%Y', birthdate) > 1970\nAmong the crew members of the simpson 20s born in the New York city, how many of them were born after the year 1970?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['voice', 'casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon refers to result = 'Winner'\nWhich character won the Outstanding Voice-Over Performance award in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.character FROM Character_Award AS T1 INNER JOIN Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.year = 2009 AND T2.result = 'Winner';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT DISTINCT T1.character FROM Character_Award AS T1 INNER JOIN Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.year = 2009 AND T2.result = 'Winner';",
"index": 2037,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['voice', 'casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon refers to result = 'Winner'\nWhich character won the Outstanding Voice-Over Performance award in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Lost Verizon', 'Sex, Pies and Idiot Scrapes']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Lost Verizon\" is the title of episode\nPlease list all the keywords of the episode Lost Verizon.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Lost Verizon';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Lost Verizon';",
"index": 2038,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Lost Verizon', 'Sex, Pies and Idiot Scrapes']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Lost Verizon\" is the title of episode\nPlease list all the keywords of the episode Lost Verizon.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-10-19', '2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired on 2008/10/19 refers to air_date = '2008-10-19'\nHow many keywords does the episode that was aired on 2008/10/19 have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2008-10-19';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2008-10-19';",
"index": 2039,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-10-19', '2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired on 2008/10/19 refers to air_date = '2008-10-19'\nHow many keywords does the episode that was aired on 2008/10/19 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 Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dan Castellaneta', 'Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Dan Castellaneta', 'Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Dan Castellaneta\" is the person; 2009 is year; won refers result = 'Winner'\nWhat's the rating of the episode in which Dan Castellaneta won the Outstanding Voice-Over Performance award in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.rating FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Outstanding Voice-Over Performance' AND SUBSTR(T1.year, 1, 4) = '2009' AND T1.person = 'Dan Castellaneta';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.rating FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Outstanding Voice-Over Performance' AND SUBSTR(T1.year, 1, 4) = '2009' AND T1.person = 'Dan Castellaneta';",
"index": 2040,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dan Castellaneta', 'Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Dan Castellaneta', 'Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Dan Castellaneta\" is the person; 2009 is year; won refers result = 'Winner'\nWhat's the rating of the episode in which Dan Castellaneta won the Outstanding Voice-Over Performance award in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Lost Verizon', 'Sex, Pies and Idiot Scrapes']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Lost Verizon\" is the title of episode; most voters refers to Max(votes)\nHow many stars did most of the voters give in star score for the episode Lost Verizon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon' ORDER BY T2.votes DESC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon' ORDER BY T2.votes DESC LIMIT 1;",
"index": 2041,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Lost Verizon', 'Sex, Pies and Idiot Scrapes']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Lost Verizon\" is the title of episode; most voters refers to Max(votes)\nHow many stars did most of the voters give in star score for the episode Lost Verizon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 200 votes refers to votes > 200; 10 in star score refers to stars = 10\nPlease list the titles of the episodes that have over 200 voters voting a 10 in star 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.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.votes > 200 AND T2.stars = 10;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.votes > 200 AND T2.stars = 10;",
"index": 2042,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nover 200 votes refers to votes > 200; 10 in star score refers to stars = 10\nPlease list the titles of the episodes that have over 200 voters voting a 10 in star 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 Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['year 2008', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in the year 2009 refers to air_date like '2009%'; 10 stars in star score refers to stars = 10; over 15% of voters refers to Votes.percent > 15\nHow many episodes aired in the year 2009 have over 15% of voters giving 10 stars in star 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 COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.stars = 10 AND T2.percent > 15;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.stars = 10 AND T2.percent > 15;",
"index": 2043,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['year 2008', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired in the year 2009 refers to air_date like '2009%'; 10 stars in star score refers to stars = 10; over 15% of voters refers to Votes.percent > 15\nHow many episodes aired in the year 2009 have over 15% of voters giving 10 stars in star 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 Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Lost Verizon', 'Sex, Pies and Idiot Scrapes']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Lost Verizon\" is the title of episode; stars on average = Divide( Sum (Multiply (votes, stars)), Sum(votes))\nHow many stars on average does the episode Lost Verizon 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 CAST(SUM(T2.votes * T2.stars) AS REAL) / SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT CAST(SUM(T2.votes * T2.stars) AS REAL) / SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon';",
"index": 2044,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Lost Verizon', 'Sex, Pies and Idiot Scrapes']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Lost Verizon\" is the title of episode; stars on average = Divide( Sum (Multiply (votes, stars)), Sum(votes))\nHow many stars on average does the episode Lost Verizon 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 Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Primetime Emmy' is the award_category; rating over 7 refers to rating > 7; nominated refers to result = 'Nominee'; percentage = Divide(Count(episode_id(award_category = 'Primetime Emmy')), Count (episode_id)) * 100\nWhat is the percentage of Primetime Emmy nominated episodes with a rating over 7 to all the episodes that have a rating over 7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.award_category = 'Primetime Emmy' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.rating > 7 AND T1.result = 'Nominee';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.award_category = 'Primetime Emmy' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.rating > 7 AND T1.result = 'Nominee';",
"index": 2045,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Primetime Emmy' is the award_category; rating over 7 refers to rating > 7; nominated refers to result = 'Nominee'; percentage = Divide(Count(episode_id(award_category = 'Primetime Emmy')), Count (episode_id)) * 100\nWhat is the percentage of Primetime Emmy nominated episodes with a rating over 7 to all the episodes that have a rating over 7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Pamela Hayden', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['Ruthie', 'voice', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Pamela Hayden', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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\"Pamela Hayden\" is the person; voice the character 'Ruthie' refers to role = 'Ruthie'\nName the title of the episode where Pamela Hayden voiced the character 'Ruthie.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Pamela Hayden' AND T2.role = 'Ruthie';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Pamela Hayden' AND T2.role = 'Ruthie';",
"index": 2046,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Pamela Hayden', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['Ruthie', 'voice', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Pamela Hayden', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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\"Pamela Hayden\" is the person; voice the character 'Ruthie' refers to role = 'Ruthie'\nName the title of the episode where Pamela Hayden voiced the character 'Ruthie.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['In the Name of the Grandfather', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Matt Groening', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Matt Groening', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Matt Groening', 'Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Matt Groening\" is the person; 'In the Name of the Grandfather' is the title of episode; episode number refers to episode; series number refers to number_in_series\nList down all the roles of Matt Groening on the episode titled 'In the Name of the Grandfather' along with the episode number and series number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.role, T1.episode, T1.number_in_series FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Matt Groening' AND T1.title = 'In the Name of the Grandfather';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.role, T1.episode, T1.number_in_series FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Matt Groening' AND T1.title = 'In the Name of the Grandfather';",
"index": 2047,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['In the Name of the Grandfather', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Matt Groening', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Matt Groening', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Matt Groening', 'Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Matt Groening\" is the person; 'In the Name of the Grandfather' is the title of episode; episode number refers to episode; series number refers to number_in_series\nList down all the roles of Matt Groening on the episode titled 'In the Name of the Grandfather' along with the episode number and series number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['eviction', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWrite down the title and summary of the episode with the keyword 'eviction.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.summary FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'eviction';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.title, T1.summary FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'eviction';",
"index": 2048,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['eviction', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWrite down the title and summary of the episode with the keyword 'eviction.'\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2009-03-22', '2009-03-29', '2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired on 3/22/2009 refers to air_date = '2009-03-22'\nWrite the title and all the keywords of the episode that was aired on 3/22/2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2009-03-22';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.title, T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2009-03-22';",
"index": 2049,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2009-03-22', '2009-03-29', '2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naired on 3/22/2009 refers to air_date = '2009-03-22'\nWrite the title and all the keywords of the episode that was aired on 3/22/2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['New York', 'California']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" is the birth_place; 'USA' is the birth_region\nHow many persons were born in New York, USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(name) FROM Person WHERE birth_place = 'New York City' AND birth_country = 'USA';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(name) FROM Person WHERE birth_place = 'New York City' AND birth_country = 'USA';",
"index": 2050,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['New York', 'California']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"New York\" is the birth_place; 'USA' is the birth_region\nHow many persons were born in New York, USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Marc Wilmore', 'Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Marc Wilmore', 'Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Marc Wilmore', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Marc Wilmore\" is the name of person\nList the name of all awards along with the award category, nominated by Marc Wilmore.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT award_id, award_category FROM Award WHERE person = 'Marc Wilmore';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT award_id, award_category FROM Award WHERE person = 'Marc Wilmore';",
"index": 2051,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Marc Wilmore', 'Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Marc Wilmore', 'Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Marc Wilmore', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Marc Wilmore\" is the name of person\nList the name of all awards along with the award category, nominated by Marc Wilmore.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest vote refers to Max(votes); lowest vote refers to Min(votes); difference = Subtract(Max(votes), Min(votes))\nCalculate the difference between the highest votes for episode and the lowest votes for episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MAX(votes) - MIN(votes) FROM Vote;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT MAX(votes) - MIN(votes) FROM Vote;",
"index": 2052,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest vote refers to Max(votes); lowest vote refers to Min(votes); difference = Subtract(Max(votes), Min(votes))\nCalculate the difference between the highest votes for episode and the lowest votes for episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Comedy Series', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; born in California refers to birth_place = 'California'; in 2009 refers to year = 2009\nAmong the person nominated for the Comedy Series Award in 2009, how many of them were born 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(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.year = 2009 AND T2.award = 'Comedy Series' AND T1.birth_region = 'California';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.year = 2009 AND T2.award = 'Comedy Series' AND T1.birth_region = 'California';",
"index": 2053,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Comedy Series', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; born in California refers to birth_place = 'California'; in 2009 refers to year = 2009\nAmong the person nominated for the Comedy Series Award in 2009, how many of them were born 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 Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['How the Test Was Won', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_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\"How the Test Was Won\" is the title of episode; not included in the credit refers to credited = ' '; name of person refers to person\nList the name of persons who were not included in the credit for the 'How the Test Was Won' episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'How the Test Was Won' AND T2.credited = 'false';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.person FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'How the Test Was Won' AND T2.credited = 'false';",
"index": 2054,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['How the Test Was Won', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_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\"How the Test Was Won\" is the title of episode; not included in the credit refers to credited = ' '; name of person refers to person\nList the name of persons who were not included in the credit for the 'How the Test Was Won' episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Take My Life, Please', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Take My Life,Please\" is the title of episode\nList all the keyword for 'Take My Life, Please' episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please';",
"index": 2055,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Take My Life, Please', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Take My Life,Please\" is the title of episode\nList all the keyword for 'Take My Life, Please' episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['voice', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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 950 votes refers to votes > 950; in 2009 refers to year = 2009; number of episode = Count(episode_id); nominated refers to result = 'Nominee'; percentage = Divide(Count(award = 'Outstanding Voice-Over Performance'), Count(episode_id)) * 100\nAmong the episode that get more than 950 votes, how many of the episodes were nominated for the 'Outstanding Voice-Over Performance Award in 2009'? Find the percentage of the episodes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.award = 'Outstanding Voice-Over Performance' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.episode_id) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 950 AND T1.year = 2009;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.award = 'Outstanding Voice-Over Performance' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.episode_id) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 950 AND T1.year = 2009;",
"index": 2056,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['voice', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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 950 votes refers to votes > 950; in 2009 refers to year = 2009; number of episode = Count(episode_id); nominated refers to result = 'Nominee'; percentage = Divide(Count(award = 'Outstanding Voice-Over Performance'), Count(episode_id)) * 100\nAmong the episode that get more than 950 votes, how many of the episodes were nominated for the 'Outstanding Voice-Over Performance Award in 2009'? Find the percentage of the episodes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['No Loan Again, Naturally', 'Coming to Homerica', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n5 stars votes refers to stars = 5 ; 'No Loan Again, Naturally' and 'Coming to Homerica' are both the title of episode; ratio = Divide (votes where title = 'No Loan Again, Naturally', votes where title = 'Coming to Homerica')\nWhat is the ratio between the 5 stars votes for 'No Loan Again, Naturally' episode and 'Coming to Homerica' episode?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title = 'No Loan Again, Naturally' THEN T1.votes ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Coming to Homerica' THEN T1.votes ELSE 0 END) AS ratio FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 5;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.title = 'No Loan Again, Naturally' THEN T1.votes ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.title = 'Coming to Homerica' THEN T1.votes ELSE 0 END) AS ratio FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 5;",
"index": 2057,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['No Loan Again, Naturally', 'Coming to Homerica', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n5 stars votes refers to stars = 5 ; 'No Loan Again, Naturally' and 'Coming to Homerica' are both the title of episode; ratio = Divide (votes where title = 'No Loan Again, Naturally', votes where title = 'Coming to Homerica')\nWhat is the ratio between the 5 stars votes for 'No Loan Again, Naturally' episode and 'Coming to Homerica' episode?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; highest number of nominated award refers to Max(Count(person))\nWhat is the name of the person that has the highest number of nominated award but didn't win?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT person FROM Award WHERE result = 'Nominee' GROUP BY person ORDER BY COUNT(person) DESC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT person FROM Award WHERE result = 'Nominee' GROUP BY person ORDER BY COUNT(person) DESC LIMIT 1;",
"index": 2058,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated refers to result = 'Nominee'; highest number of nominated award refers to Max(Count(person))\nWhat is the name of the person that has the highest number of nominated award but didn't win?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to Min(rating)\nWhat is the title of the episode that received the lowest rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM Episode ORDER BY rating LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT title FROM Episode ORDER BY rating LIMIT 1;",
"index": 2059,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest rating refers to Min(rating)\nWhat is the title of the episode that received the lowest rating?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: [\"People's Choice Award\", 'Primetime Emmy', 'Annie']\n award text, -- example: ['Favorite Animated Comedy', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n PRIMARY KEY (episode_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\"Favorite Animated Comedy\" is the award; 'People's Choice Award' is the award_category; received award refers to result = 'Winner'; first ever award refers to Min(year)\nWhat year did the Simpsons receive its first ever award for Favorite Animated Comedy in People's Choice Award?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT year FROM Award WHERE result = 'Winner' AND award = 'Favorite Animated Comedy' ORDER BY year DESC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT year FROM Award WHERE result = 'Winner' AND award = 'Favorite Animated Comedy' ORDER BY year DESC LIMIT 1;",
"index": 2060,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: [\"People's Choice Award\", 'Primetime Emmy', 'Annie']\n award text, -- example: ['Favorite Animated Comedy', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_region text, -- example: ['California', 'New York']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n PRIMARY KEY (episode_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\"Favorite Animated Comedy\" is the award; 'People's Choice Award' is the award_category; received award refers to result = 'Winner'; first ever award refers to Min(year)\nWhat year did the Simpsons receive its first ever award for Favorite Animated Comedy in People's Choice Award?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dell Hake', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Dell Hake', 'Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Dell Hake\" is the person; not included in the credit list refers to credited = ''\nHow many episodes was Dell Hake not included in the credit list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Credit WHERE person = 'Dell Hake' AND credited = 'false';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Credit WHERE person = 'Dell Hake' AND credited = 'false';",
"index": 2061,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dell Hake', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Dell Hake', 'Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Dell Hake\" is the person; not included in the credit list refers to credited = ''\nHow many episodes was Dell Hake not included in the credit list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dan Castellaneta', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Dan Castellaneta', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['voice', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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\"Dan Castellaneta\" is the person; won refers to result = 'Winner'; 'Outstanding Voice-Over Performance' is the award; 'Primetime Emmy Awards' is the organization; in 2009 refers to year = 2009\nWhat character did Dan Castellaneta play that won him an award for Outstanding Voice-Over Performance in 2009 in the Primetime Emmy Awards?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.person = 'Dan Castellaneta' AND T1.award = 'Outstanding Voice-Over Performance' AND T1.organization = 'Primetime Emmy Awards' AND T1.year = 2009;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT DISTINCT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.person = 'Dan Castellaneta' AND T1.award = 'Outstanding Voice-Over Performance' AND T1.organization = 'Primetime Emmy Awards' AND T1.year = 2009;",
"index": 2062,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Best Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Dan Castellaneta', 'Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Dan Castellaneta', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['voice', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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\"Dan Castellaneta\" is the person; won refers to result = 'Winner'; 'Outstanding Voice-Over Performance' is the award; 'Primetime Emmy Awards' is the organization; in 2009 refers to year = 2009\nWhat character did Dan Castellaneta play that won him an award for Outstanding Voice-Over Performance in 2009 in the Primetime Emmy Awards?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Online Film & Television Association', 'Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Best Voice-Over Performance', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon refers to result = 'Winner'; 'Best Voice-Over Performance' is the award; ' Online Film & Television Association' is the organization; in 2009 refers to year = 2009\nWhat is the birth place of the cast or crew member who won the Best Voice-Over Performance in Online Film & Television Association in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birth_place FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Best Voice-Over Performance' AND T2.organization = 'Online Film & Television Association' AND T2.year = 2009;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.birth_place FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Best Voice-Over Performance' AND T2.organization = 'Online Film & Television Association' AND T2.year = 2009;",
"index": 2063,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Online Film & Television Association', 'Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Best Voice-Over Performance', 'Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n number_in_series integer, -- example: [421, 422]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon refers to result = 'Winner'; 'Best Voice-Over Performance' is the award; ' Online Film & Television Association' is the organization; in 2009 refers to year = 2009\nWhat is the birth place of the cast or crew member who won the Best Voice-Over Performance in Online Film & Television Association in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10 stars votes refers to stars = 10; highest rating refers to Max(rating); number of votes refers to SUM(votes)\nHow many 10 star votes did the top 4 episodes with the highest rating received?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 10 ORDER BY T1.rating DESC LIMIT 4;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT SUM(T1.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 10 ORDER BY T1.rating DESC LIMIT 4;",
"index": 2064,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n10 stars votes refers to stars = 10; highest rating refers to Max(rating); number of votes refers to SUM(votes)\nHow many 10 star votes did the top 4 episodes with the highest rating received?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['No Loan Again, Naturally', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"No Loan Again, Naturally\" is the title of episode; votes of no more than 50 refers to votes < 50; number of stars refers to SUM(stars)\nIn \"No Loan Again, Naturally\", how many stars received votes 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(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'No Loan Again, Naturally' AND T2.votes < 50;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'No Loan Again, Naturally' AND T2.votes < 50;",
"index": 2065,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['No Loan Again, Naturally', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"No Loan Again, Naturally\" is the title of episode; votes of no more than 50 refers to votes < 50; number of stars refers to SUM(stars)\nIn \"No Loan Again, Naturally\", how many stars received votes 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 Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naward winner refers to result = 'Winner'; 'USA' is the birth_country\nHow many award winners are from the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T1.birth_country = 'USA' AND T2.result = 'Winner';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T1.birth_country = 'USA' AND T2.result = 'Winner';",
"index": 2066,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naward winner refers to result = 'Winner'; 'USA' is the birth_country\nHow many award winners are from the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Doofus', 'Jim']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E11', 'S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E11', 'S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E13', 'S20-E16', 'S20-E18']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E11', 'S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E11', 'S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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 Season 20 Episode 11 refers to episode_id = 'S20-E11'; 'Doofus' is the nickname of person; include in credit list refers to credited = 'true'\nIn Season 20 Episode 11, how many times was Doofus included in the credit list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T1.nickname = 'Doofus' AND T2.credited = 'true' AND T2.episode_id = 'S20-E11';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T1.nickname = 'Doofus' AND T2.credited = 'true' AND T2.episode_id = 'S20-E11';",
"index": 2067,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Doofus', 'Jim']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E11', 'S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E11', 'S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E13', 'S20-E16', 'S20-E18']\n season text,\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E11', 'S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E11', 'S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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 Season 20 Episode 11 refers to episode_id = 'S20-E11'; 'Doofus' is the nickname of person; include in credit list refers to credited = 'true'\nIn Season 20 Episode 11, how many times was Doofus included in the credit list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Sex, Pies and Idiot Scrapes\" is the title of episode; 9 star score refers to stars = 9; percentage refers to percent\nIn \"Sex, Pies and Idiot Scrapes\", how many percentage of votes did the 9 star score has?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.percent FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Sex, Pies and Idiot Scrapes' AND T2.stars = 9;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.percent FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Sex, Pies and Idiot Scrapes' AND T2.stars = 9;",
"index": 2068,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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\"Sex, Pies and Idiot Scrapes\" is the title of episode; 9 star score refers to stars = 9; percentage refers to percent\nIn \"Sex, Pies and Idiot Scrapes\", how many percentage of votes did the 9 star score has?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon the award refers to result = 'Winner'; in 2009 refers to year = 2009\nList the award name and persons who won the award in 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT award, person FROM Award WHERE result = 'Winner' AND SUBSTR(year, 1, 4) = '2009';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT award, person FROM Award WHERE result = 'Winner' AND SUBSTR(year, 1, 4) = '2009';",
"index": 2069,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwon the award refers to result = 'Winner'; in 2009 refers to year = 2009\nList the award name and persons who won the award in 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Billy Kimball', 'Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Billy Kimball', 'Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Billy Kimball', 'Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n PRIMARY KEY (episode_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\"Billy Kimball\" is the person; award name refers to award; credited category refers to category; credited status refers to credited; credited = 'true' means the person is included in the credit list and vice versa\nList down the award name, result, credit category and credited status of the \"Billy Kimball\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.award, T1.result, T2.category, T2.credited FROM Award AS T1 INNER JOIN Credit AS T2 ON T2.episode_id = T1.episode_id WHERE T2.person = 'Billy Kimball';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT DISTINCT T1.award, T1.result, T2.category, T2.credited FROM Award AS T1 INNER JOIN Credit AS T2 ON T2.episode_id = T1.episode_id WHERE T2.person = 'Billy Kimball';",
"index": 2070,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Billy Kimball', 'Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Billy Kimball', 'Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Billy Kimball', 'Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n PRIMARY KEY (episode_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\"Billy Kimball\" is the person; award name refers to award; credited category refers to category; credited status refers to credited; credited = 'true' means the person is included in the credit list and vice versa\nList down the award name, result, credit category and credited status of the \"Billy Kimball\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['assistant director', 'director', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E13', 'S20-E16', 'S20-E18']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E13', 'S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E13', 'S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E13', 'S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E13', 'S20-E10']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['assistant director', 'director', 'Director', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"assistant director\" is the role of person; 'S20-E13' is the episode_id; credited status refers to credited; credited = 'true' means the person is included in the credit list and vice versa\nName the person, award, organization, result and credited status of the assistant director in S20-E13.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person, T1.award, T1.organization, T1.result, T2.credited FROM Award AS T1 INNER JOIN Credit AS T2 ON T2.episode_id = T1.episode_id WHERE T2.episode_id = 'S20-E13' AND T2.role = 'assistant director';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.person, T1.award, T1.organization, T1.result, T2.credited FROM Award AS T1 INNER JOIN Credit AS T2 ON T2.episode_id = T1.episode_id WHERE T2.episode_id = 'S20-E13' AND T2.role = 'assistant director';",
"index": 2071,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['assistant director', 'director', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E13', 'S20-E16', 'S20-E18']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E13', 'S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E13', 'S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E13', 'S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E13', 'S20-E10']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['assistant director', 'director', 'Director', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"assistant director\" is the role of person; 'S20-E13' is the episode_id; credited status refers to credited; credited = 'true' means the person is included in the credit list and vice versa\nName the person, award, organization, result and credited status of the assistant director in S20-E13.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Cast', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheight refers to height_meters; not in credit list refers to credited = ''; category of casting refers to category = 'Casting Department'\nDescribe the birth country, height and person name who were not included in credit list with category of casting.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.birth_country, T1.height_meters, T1.name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.category = 'Cast' AND T2.credited = 'false';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.birth_country, T1.height_meters, T1.name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.category = 'Cast' AND T2.credited = 'false';",
"index": 2072,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Cast', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheight refers to height_meters; not in credit list refers to credited = ''; category of casting refers to category = 'Casting Department'\nDescribe the birth country, height and person name who were not included in credit list with category of casting.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['The Good, the Sad and the Drugly', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominee refers to result = 'Nominee'\nList the nominee, keywords and episode ID of the title \"The Good, the Sad and the Drugly\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person, T1.keyword, T1.episode_id FROM Keyword AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Award AS T3 ON T2.episode_id = T3.episode_id WHERE T2.title = 'The Good, the Sad and the Drugly' AND T3.result = 'Nominee';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T3.person, T1.keyword, T1.episode_id FROM Keyword AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Award AS T3 ON T2.episode_id = T3.episode_id WHERE T2.title = 'The Good, the Sad and the Drugly' AND T3.result = 'Nominee';",
"index": 2073,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['The Good, the Sad and the Drugly', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominee refers to result = 'Nominee'\nList the nominee, keywords and episode ID of the title \"The Good, the Sad and the Drugly\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['arab stereotype', 'what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbest rating scale refers to stars = 10\nWhat is the voting numbers and percentage of the best rating scale of the episode which had keyword of \"arab stereotype\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.votes, T2.percent FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.keyword = 'arab stereotype' AND T2.stars = 10;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.votes, T2.percent FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T1.keyword = 'arab stereotype' AND T2.stars = 10;",
"index": 2074,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['arab stereotype', 'what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbest rating scale refers to stars = 10\nWhat is the voting numbers and percentage of the best rating scale of the episode which had keyword of \"arab stereotype\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDescribe the award title, person and character name of the award ID 326.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.award, T1.person, T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award_id = 326;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT DISTINCT T1.award, T1.person, T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award_id = 326;",
"index": 2075,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDescribe the award title, person and character name of the award ID 326.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['North Korea', 'USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of credits refers to credited; born in North Korea refers to birth_country = 'North Korea'\nProvide the number of credits, category, role and birthplace of the crew member who was born in North Korea.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.credited, T2.category, T2.role, T1.birth_place FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T1.birth_country = 'North Korea';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT DISTINCT T2.credited, T2.category, T2.role, T1.birth_place FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T1.birth_country = 'North Korea';",
"index": 2076,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['North Korea', 'USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of credits refers to credited; born in North Korea refers to birth_country = 'North Korea'\nProvide the number of credits, category, role and birthplace of the crew member who was born in North Korea.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2010 refers to year = 2010; winning rate refers to DIVIDE(COUNT(result = 'winner'), COUNT(*));\nFind the winning rate of award in 2010. Describe the winner name, award name, episode title and role of the winner in that episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.rate, T4.person, T4.award, T5.title, T4.role FROM ( SELECT CAST(SUM(CASE WHEN T1.result = 'Winner' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.result IN ('Winner', 'Nominee') THEN 1 ELSE 0 END) AS rate , T1.person, T1.award, T2.title, T1.role FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2010' ) AS T3 INNER JOIN Award AS T4 INNER JOIN Episode AS T5 ON T4.episode_id = T5.episode_id WHERE T4.year = 2010 AND T4.result = 'Winner';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T3.rate, T4.person, T4.award, T5.title, T4.role FROM ( SELECT CAST(SUM(CASE WHEN T1.result = 'Winner' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.result IN ('Winner', 'Nominee') THEN 1 ELSE 0 END) AS rate , T1.person, T1.award, T2.title, T1.role FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2010' ) AS T3 INNER JOIN Award AS T4 INNER JOIN Episode AS T5 ON T4.episode_id = T5.episode_id WHERE T4.year = 2010 AND T4.result = 'Winner';",
"index": 2077,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2010 refers to year = 2010; winning rate refers to DIVIDE(COUNT(result = 'winner'), COUNT(*));\nFind the winning rate of award in 2010. Describe the winner name, award name, episode title and role of the winner in that episode.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreceived the highest star score refers to MAX(stars); the highest number of votes refers to MAX(votes)\nName the title of the episode that received the highest star score and the highest number of votes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id ORDER BY T2.stars DESC, T2.votes DESC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id ORDER BY T2.stars DESC, T2.votes DESC LIMIT 1;",
"index": 2078,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreceived the highest star score refers to MAX(stars); the highest number of votes refers to MAX(votes)\nName the title of the episode that received the highest star score and the highest number of votes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated for refers to result = 'Nominee'; Outstanding Animated Program refers to award = 'Outstanding Animated Program (For Programming Less Than One Hour)'; Emmy's refers to organization = 'Primetime Emmy Awards'; 21 times refers to COUNT(episode_id) = 21;\nName the title of the episode that was nominated for Emmy's Outstanding Animated Program 21 times.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.organization = 'Primetime Emmy Awards' AND T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T1.result = 'Nominee' GROUP BY T1.episode_id HAVING COUNT(T1.episode_id) = 21;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.organization = 'Primetime Emmy Awards' AND T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T1.result = 'Nominee' GROUP BY T1.episode_id HAVING COUNT(T1.episode_id) = 21;",
"index": 2079,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnominated for refers to result = 'Nominee'; Outstanding Animated Program refers to award = 'Outstanding Animated Program (For Programming Less Than One Hour)'; Emmy's refers to organization = 'Primetime Emmy Awards'; 21 times refers to COUNT(episode_id) = 21;\nName the title of the episode that was nominated for Emmy's Outstanding Animated Program 21 times.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Billy Kimball', 'Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Billy Kimball', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Billy Kimball', 'Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2010 refers to year = 2010; nominations refers to result = 'Nominee'\nHow many nominations have Billy Kimball received in 2010 for The simpson 20s: Season 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(award_id) FROM Award WHERE person = 'Billy Kimball' AND SUBSTR(year, 1, 4) = '2010' AND result = 'Nominee';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(award_id) FROM Award WHERE person = 'Billy Kimball' AND SUBSTR(year, 1, 4) = '2010' AND result = 'Nominee';",
"index": 2080,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Billy Kimball', 'Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Nominee', 'Winner']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Billy Kimball', 'Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Billy Kimball', 'Adam Greeley', 'Adam Klein']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2010 refers to year = 2010; nominations refers to result = 'Nominee'\nHow many nominations have Billy Kimball received in 2010 for The simpson 20s: Season 20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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 recent refers to MAX(year); received refers to result = 'Winner'; name of award refers to award; category refers to award_category\nIndicate the name and category of the most recent award received by the show.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT award, award_category FROM Award WHERE result = 'Winner' ORDER BY year DESC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT award, award_category FROM Award WHERE result = 'Winner' ORDER BY year DESC LIMIT 1;",
"index": 2081,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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 recent refers to MAX(year); received refers to result = 'Winner'; name of award refers to award; category refers to award_category\nIndicate the name and category of the most recent award received by the show.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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 awards winning rate refers to DIVIDE(SUM(result = 'winner'), COUNT(award));\nWhat is The simpson 20s: Season 20 average awards winning rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN result = 'Winner' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(award) AS rate FROM Award;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN result = 'Winner' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(award) AS rate FROM Award;",
"index": 2082,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['what if', '1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_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 awards winning rate refers to DIVIDE(SUM(result = 'winner'), COUNT(award));\nWhat is The simpson 20s: Season 20 average awards winning rate?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1957-10-29', '1957-10-25', '1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['Chicago', 'USA', 'Brooklyn']\n birth_region text, -- example: ['Illinois', 'California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in October 29, 1957 refers to birthdate = '1957-10-29'; in Chicago refers to birth_place = 'Chicago'; Illinois refers to birth_region = 'Illinois'\nWho from The simpson 20s: Season 20 cast and crew was born in October 29, 1957 in Chicago, Illinois?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Person WHERE birthdate = '1957-10-29' AND birth_place = 'Chicago' AND birth_region = 'Illinois';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT name FROM Person WHERE birthdate = '1957-10-29' AND birth_place = 'Chicago' AND birth_region = 'Illinois';",
"index": 2083,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Cast', 'Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1957-10-29', '1957-10-25', '1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['Chicago', 'USA', 'Brooklyn']\n birth_region text, -- example: ['Illinois', 'California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in October 29, 1957 refers to birthdate = '1957-10-29'; in Chicago refers to birth_place = 'Chicago'; Illinois refers to birth_region = 'Illinois'\nWho from The simpson 20s: Season 20 cast and crew was born in October 29, 1957 in Chicago, Illinois?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in the USA refers to birth_country = 'USA'\nHow many crews were born in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(name) FROM Person WHERE birth_country = 'USA';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(name) FROM Person WHERE birth_country = 'USA';",
"index": 2084,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in the USA refers to birth_country = 'USA'\nHow many crews were born in the USA?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn before 1970 refers to birthdate < '1970-01-01'\nPlease list the name of crew that were born before 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) < '1970';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) < '1970';",
"index": 2085,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn before 1970 refers to birthdate < '1970-01-01'\nPlease list the name of crew that were born before 1970.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in California refers to birth_place = 'California'; USA refers to birth_country = 'USA'; between 1958 and 1969 refers to birthdate BETWEEN '1958-01-01' and '1958-12-31'\nName of the crew that were born in California, USA between 1958 and 1969.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1958' AND birth_place = 'California' AND birth_country = 'USA';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1958' AND birth_place = 'California' AND birth_country = 'USA';",
"index": 2086,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in California refers to birth_place = 'California'; USA refers to birth_country = 'USA'; between 1958 and 1969 refers to birthdate BETWEEN '1958-01-01' and '1958-12-31'\nName of the crew that were born in California, USA between 1958 and 1969.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 100 votes refers to votes > 100\nWhich episode ids are rated 5 stars and have more than 100 votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT episode_id FROM Vote WHERE stars = 5 AND votes > 100;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT episode_id FROM Vote WHERE stars = 5 AND votes > 100;",
"index": 2087,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 100 votes refers to votes > 100\nWhich episode ids are rated 5 stars and have more than 100 votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisodes from 10 to 20 refers to episode BETWEEN 10 and 20; more than 200 votes refers to COUNT(votes) > 200\nAmong episodes from 10 to 20, which episode has more than 200 votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.episode FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.episode BETWEEN 10 AND 20 AND T2.votes > 200;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT DISTINCT T1.episode FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.episode BETWEEN 10 AND 20 AND T2.votes > 200;",
"index": 2088,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nepisodes from 10 to 20 refers to episode BETWEEN 10 and 20; more than 200 votes refers to COUNT(votes) > 200\nAmong episodes from 10 to 20, which episode has more than 200 votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPrimetime Emmy Award refers to award_category = 'Primetime Emmy'; the most votes refers to MAX(votes)\nWho is the recipient of the Primetime Emmy Award with the most votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'Primetime Emmy' ORDER BY T2.votes DESC LIMIT 1;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.person FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'Primetime Emmy' ORDER BY T2.votes DESC LIMIT 1;",
"index": 2089,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPrimetime Emmy Award refers to award_category = 'Primetime Emmy'; the most votes refers to MAX(votes)\nWho is the recipient of the Primetime Emmy Award with the most votes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['director', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['director', 'Director', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['No Loan Again, Naturally', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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 director refers to role = 'director'\nPlease give the name of the director who achieved the Outstanding Animated Program (For Programming Less Than One Hour) award whose episode title is \"No Loan Again, Naturally\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.role = 'director' AND T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.title = 'No Loan Again, Naturally';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.person FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.role = 'director' AND T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.title = 'No Loan Again, Naturally';",
"index": 2090,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['director', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['director', 'Director', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['No Loan Again, Naturally', 'Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_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 director refers to role = 'director'\nPlease give the name of the director who achieved the Outstanding Animated Program (For Programming Less Than One Hour) award whose episode title is \"No Loan Again, Naturally\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['writer', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['writer', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwriter refers to role = 'writer'; star score greater than 5 refers to stars > 5; in 2009 refers to year = 2009\nPlease indicate which writer has an episode star score greater than 5 in 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.person FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2009' AND T1.role = 'writer' AND T2.votes > 5;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.person FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2009' AND T1.role = 'writer' AND T2.votes > 5;",
"index": 2091,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['writer', 'executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['writer', 'casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwriter refers to role = 'writer'; star score greater than 5 refers to stars > 5; in 2009 refers to year = 2009\nPlease indicate which writer has an episode star score greater than 5 in 2009.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['WGA Award (TV)', 'Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWGA Award (TV) award refers to award_category = 'WGA Award (TV)'; born in the USA refers to birth_country = 'USA'; from 2009 to 2010 refers to birthdate BETWEEN '2019-01-01' and '2019-12-31'\nHow many WGA Award (TV) award recipients were born in the USA from 2009 to 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award_category = 'WGA Award (TV)' AND T1.birth_country = 'USA' AND T2.year BETWEEN 2009 AND 2010;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award_category = 'WGA Award (TV)' AND T1.birth_country = 'USA' AND T2.year BETWEEN 2009 AND 2010;",
"index": 2092,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['WGA Award (TV)', 'Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWGA Award (TV) award refers to award_category = 'WGA Award (TV)'; born in the USA refers to birth_country = 'USA'; from 2009 to 2010 refers to birthdate BETWEEN '2019-01-01' and '2019-12-31'\nHow many WGA Award (TV) award recipients were born in the USA from 2009 to 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nless than 100 votes refers to votes < 100; percentage refers to DIVIDE(COUNT(episode_id when votes < 100), COUNT(episode_id)) * 100%\nHow many episodes have won the award for Outstanding Animated Program (Programming Under One Hour) with less than 100 votes? Calculate the percentage of episodes with less than 100 votes out of total episodes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.votes < 100 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.votes < 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Award AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T2.votes < 100 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.votes < 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Award AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)';",
"index": 2093,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nless than 100 votes refers to votes < 100; percentage refers to DIVIDE(COUNT(episode_id when votes < 100), COUNT(episode_id)) * 100%\nHow many episodes have won the award for Outstanding Animated Program (Programming Under One Hour) with less than 100 votes? Calculate the percentage of episodes with less than 100 votes out of total episodes.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in the USA refers to birth_country = 'USA'; recipients refers to person = 'recipients'; percentage refers to DIVIDE(COUNT(birth_country = 'USA'), count(award_id))\nHow many recipients of the Primetime Emmy Award category that were born in the USA? Find the percentage of Americans in the total number of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award_category = 'Primetime Emmy' AND T2.person = 'Dan Castellaneta';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award_category = 'Primetime Emmy' AND T2.person = 'Dan Castellaneta';",
"index": 2094,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n rating real, -- example: [7.2, 7.0]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in the USA refers to birth_country = 'USA'; recipients refers to person = 'recipients'; percentage refers to DIVIDE(COUNT(birth_country = 'USA'), count(award_id))\nHow many recipients of the Primetime Emmy Award category that were born in the USA? Find the percentage of Americans in the total number of the country.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1962 refers to year(birthdate) = 1962; in California refers to birth_region = 'California'\nIn the crew, who was born in 1962 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 name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1962' AND birth_region = 'California';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1962' AND birth_region = 'California';",
"index": 2095,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n `year` integer, -- example: [2009, 2010]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n award text, -- example: ['Outstanding Voice-Over Performance', 'Outstanding Animated Program (For Progra']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1962 refers to year(birthdate) = 1962; in California refers to birth_region = 'California'\nIn the crew, who was born in 1962 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 Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['Canada', 'USA']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntaller than 1.70m refers to height_meters > 1.70; born in Canada refers to birth_country = 'Canada'\nHow many of the crew members who are taller than 1.70m were born in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(name) FROM Person WHERE height_meters > 1.70 AND birth_country = 'Canada';",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT COUNT(name) FROM Person WHERE height_meters > 1.70 AND birth_country = 'Canada';",
"index": 2096,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n `percent` real, -- example: [1.3, 1.7]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_country text, -- example: ['Canada', 'USA']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n `year` integer, -- example: [2009, 2010]\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n song text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntaller than 1.70m refers to height_meters > 1.70; born in Canada refers to birth_country = 'Canada'\nHow many of the crew members who are taller than 1.70m were born in Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nan excellent rating refers to 7 < rating < = 10\nPlease list any three episodes that have an excellent rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM Episode WHERE rating BETWEEN 7 AND 10 LIMIT 3;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT title FROM Episode WHERE rating BETWEEN 7 AND 10 LIMIT 3;",
"index": 2097,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n episode_image text, -- example: ['https://m.media-amazon.com/images/M/MV5B']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_place text, -- example: ['USA', 'Brooklyn']\n birth_region text, -- example: ['California', 'New York']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n `role` text, -- example: ['casting', 'additional timer']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n `role` text, -- example: ['executive producer', 'co-executive producer']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n season text,\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nan excellent rating refers to 7 < rating < = 10\nPlease list any three episodes that have an excellent rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_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 popular episodes refers to MAX(votes)\nWhat are the top five most popular episodes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT episode_id FROM Episode ORDER BY votes DESC LIMIT 5;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT episode_id FROM Episode ORDER BY votes DESC LIMIT 5;",
"index": 2098,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n category text, -- example: ['Casting Department', 'Animation Department']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n credited text, -- example: ['true', 'false']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n birth_name text, -- example: ['Marc Edward Wilmore', 'Valentina Lantigua']\n birth_country text, -- example: ['USA', 'Canada']\n height_meters real, -- example: [1.85, 1.75]\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n award_category text, -- example: ['Primetime Emmy', 'Annie']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n episode integer, -- example: [1, 2]\n summary text, -- example: ['Homer and Ned go into business together ', 'Bart gets in trouble with Marge after sh']\n air_date text, -- example: ['2008-09-28', '2008-10-05']\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_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 popular episodes refers to MAX(votes)\nWhat are the top five most popular episodes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of votes refers to MAX(COUNT(votes)); worst star rating refers to stars = 1\nPlease list the three episodes with the highest number of votes for the worst star rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = ( SELECT MIN(stars) FROM Vote ) ORDER BY T2.votes DESC LIMIT 3;",
"style": "rule"
} | {
"db_id": "simpson_episodes.sqlite",
"gt_sql": "SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = ( SELECT MIN(stars) FROM Vote ) ORDER BY T2.votes DESC LIMIT 3;",
"index": 2099,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Award (\n award_id integer, -- example: [325, 326]\n organization text, -- example: ['Primetime Emmy Awards', 'Annie Awards']\n person text, -- example: ['Dan Castellaneta', 'Hank Azaria']\n episode_id text, -- example: ['S20-E18', 'S20-E16']\n result text, -- example: ['Winner', 'Nominee']\n PRIMARY KEY (award_id),\n CONSTRAINT fk_award_person FOREIGN KEY (person) REFERENCES Person (name),\n CONSTRAINT fk_award_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Episode (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n season integer, -- example: [20]\n episode integer, -- example: [1, 2]\n number_in_series integer, -- example: [421, 422]\n title text, -- example: ['Sex, Pies and Idiot Scrapes', 'Lost Verizon']\n rating real, -- example: [7.2, 7.0]\n votes integer, -- example: [1192, 1055]\n PRIMARY KEY (episode_id)\n);\n\nCREATE TABLE Vote (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n stars integer, -- example: [2, 3]\n votes integer, -- example: [16, 20]\n CONSTRAINT fk_vote_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Keyword (\n episode_id text, -- example: ['S20-E1', 'S20-E10']\n keyword text, -- example: ['1930s to 2020s', 'erotic bakery']\n PRIMARY KEY (episode_id, keyword),\n CONSTRAINT fk_keyword_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id)\n);\n\nCREATE TABLE Character_Award (\n award_id integer, -- example: [325, 326]\n `character` text, -- example: ['Homer Simpson', 'Moe Szyslak']\n CONSTRAINT fk_character_award_award_id FOREIGN KEY (award_id) REFERENCES Award (award_id)\n);\n\nCREATE TABLE Person (\n name text, -- example: ['Adam Greeley', 'Adam Klein']\n birthdate text, -- example: ['1963-05-04', '1975-03-30']\n height_meters real, -- example: [1.85, 1.75]\n nickname text, -- example: ['Jim', 'Doofus']\n PRIMARY KEY (name)\n);\n\nCREATE TABLE Credit (\n episode_id text, -- example: ['S20-E10', 'S20-E13']\n person text, -- example: ['Bonita Pietila', 'Adam Kuhlman']\n CONSTRAINT fk_credit_episode_id FOREIGN KEY (episode_id) REFERENCES Episode (episode_id),\n CONSTRAINT fk_credit_person FOREIGN KEY (person) REFERENCES Person (name)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest number of votes refers to MAX(COUNT(votes)); worst star rating refers to stars = 1\nPlease list the three episodes with the highest number of votes for the worst star rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.