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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 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);\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 Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_16 text, -- example: ['High', '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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_ID = 1\nHow many users received high compliment type in photo?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.user_id) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'High' AND T2.compliment_id = 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.user_id) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'High' AND T2.compliment_id = 1", "index": 1900, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\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 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);\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 Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_16 text, -- example: ['High', '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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhigh compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_ID = 1\nHow many users received high compliment type in photo?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Waiter Service', 'Alcohol']\n PRIMARY KEY (attribute_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 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 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 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_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 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', '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 compliment_type text, -- example: ['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_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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'Phoenix' is the city; waiter service refers to attribute_name = 'waiter_services'\nHow many businesses in Phoenix, Arizona is attributed to waiter service?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.business_id) FROM 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.city LIKE 'Phoenix' AND T3.attribute_name LIKE 'waiter_service' AND T2.attribute_id = 2", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(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 T1.city LIKE 'Phoenix' AND T3.attribute_name LIKE 'waiter_service' AND T2.attribute_id = 2", "index": 1901, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Waiter Service', 'Alcohol']\n PRIMARY KEY (attribute_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 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 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 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_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 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', '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 compliment_type text, -- example: ['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_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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'Phoenix' is the city; waiter service refers to attribute_name = 'waiter_services'\nHow many businesses in Phoenix, Arizona is attributed to waiter service?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Long', '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);\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_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 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_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_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: ['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_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 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 (\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 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 tip_length text, -- example: ['Long', '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 attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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:\nyear with yelp = Subtract ('%Y'(CURRENT TIME), user_yelping_since_year)\nHow many business have been reviewed by user ID 3 and how long have this user been with Yelp?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.business_id) , strftime('%Y', 'now') - T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) , strftime('%Y', 'now') - T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3", "index": 1902, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\n review_votes_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Long', '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);\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_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_2 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_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_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: ['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_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 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 (\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 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 tip_length text, -- example: ['Long', '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 attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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:\nyear with yelp = Subtract ('%Y'(CURRENT TIME), user_yelping_since_year)\nHow many business have been reviewed by user ID 3 and how long have this user been with Yelp?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n PRIMARY KEY (user_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 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 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 stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (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 Compliments (\n compliment_id integer, -- example: [1, 2]\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 Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\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:\nyearly average review = Divide( Count(business_id), Subtract('%Y'(CURRENT_TIME), user_yelping_since_year))\nWhat is the yearly average review done by user 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 COUNT(review_stars) / (strftime('%Y', 'now') - T1.user_yelping_since_year) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(review_stars) / (strftime('%Y', 'now') - T1.user_yelping_since_year) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3", "index": 1903, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_5 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_7 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\n PRIMARY KEY (user_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 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 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 stars real, -- example: [3.0, 4.5]\n PRIMARY KEY (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 Compliments (\n compliment_id integer, -- example: [1, 2]\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 Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 1]\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:\nyearly average review = Divide( Count(business_id), Subtract('%Y'(CURRENT_TIME), user_yelping_since_year))\nWhat is the yearly average review done by user 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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 Years (\n year_id 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 tip_length text, -- example: ['Medium', 'Short']\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_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_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 PRIMARY KEY (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);\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 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 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_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 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_16 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Hotel & Travel\" is the category_name; most review refers to Max(Count(category_id)); Average star per user = Divide (Sum (review_stars), Count(user_id))\nFind out which hotel and travel business having the most review? Calculate the standard deviation of the review star for this business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.category_id FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Reviews AS T3 ON T3.business_id = T1.business_id WHERE T2.category_name = 'Hotels & Travel' GROUP BY T2.category_id ORDER BY COUNT(T2.category_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.category_id FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Reviews AS T3 ON T3.business_id = T1.business_id WHERE T2.category_name = 'Hotels & Travel' GROUP BY T2.category_id ORDER BY COUNT(T2.category_id) DESC LIMIT 1", "index": 1904, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 Years (\n year_id 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 tip_length text, -- example: ['Medium', 'Short']\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_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_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 PRIMARY KEY (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);\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 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 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_3 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 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_16 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Hotel & Travel\" is the category_name; most review refers to Max(Count(category_id)); Average star per user = Divide (Sum (review_stars), Count(user_id))\nFind out which hotel and travel business having the most review? Calculate the standard deviation of the review star for this business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\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 attribute_value text, -- example: ['true', '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);\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);\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_3 text, -- example: ['None', 'Low']\n label_time_4 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_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_16 text, -- example: ['None', 'Low']\n label_time_18 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_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 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_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 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 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 (\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 Days (\n day_id integer, -- example: [1, 2]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive refers to active = 'true'\nHow many of the businesses are active?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 active LIKE 'True'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE active LIKE 'True'", "index": 1905, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 (\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);\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_3 text, -- example: ['None', 'Low']\n label_time_4 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_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_16 text, -- example: ['None', 'Low']\n label_time_18 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_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 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_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 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 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 (\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 Days (\n day_id integer, -- example: [1, 2]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive refers to active = 'true'\nHow many of the businesses are active?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 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_1 text, -- example: ['Low', 'None']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_19 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 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 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_length text, -- example: ['Medium', 'Short']\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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Phoenix ', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Phoenix\" is the city; low review count refers to review_count = 'Low'\nList down the business ID with a low review count in Phoenix.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT business_id FROM Business WHERE city LIKE 'Phoenix' AND review_count LIKE 'Low'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT business_id FROM Business WHERE city LIKE 'Phoenix' AND review_count LIKE 'Low'", "index": 1906, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 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_1 text, -- example: ['Low', 'None']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_19 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 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 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_length text, -- example: ['Medium', 'Short']\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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Phoenix ', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Phoenix\" is the city; low review count refers to review_count = 'Low'\nList down the business ID with a low review count in Phoenix.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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_1 text, -- example: ['High', '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: ['High', 'None', 'Low']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_13 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_17 text, -- example: ['Low', 'None']\n label_time_18 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 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 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 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 (\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: ['High', 'Low', 'Medium']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business refers to active = 'true'; 'AZ' is the state; high review count refers to review_count = 'High'\nWhat is the total number of active business in AZ with a 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(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'High' AND active LIKE 'True'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'High' AND active LIKE 'True'", "index": 1907, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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_1 text, -- example: ['High', '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: ['High', 'None', 'Low']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_13 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_17 text, -- example: ['Low', 'None']\n label_time_18 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 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 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 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 (\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: ['High', 'Low', 'Medium']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business refers to active = 'true'; 'AZ' is the state; high review count refers to review_count = 'High'\nWhat is the total number of active business in AZ with a 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 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_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 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_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 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 Users (\n user_id integer, -- example: [1, 2]\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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\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 PRIMARY KEY (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_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 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 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_2 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_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 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:\n\"60776\" is the user_id\nWhat is the review length of user 60776 to business with business ID 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT review_length FROM Reviews WHERE user_id = 60776 AND business_id = 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT review_length FROM Reviews WHERE user_id = 60776 AND business_id = 1", "index": 1908, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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_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 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 Users (\n user_id integer, -- example: [1, 2]\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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\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 PRIMARY KEY (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_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 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 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_2 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_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 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:\n\"60776\" is the user_id\nWhat is the review length of user 60776 to business with business ID 1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 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 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 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 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 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_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: ['Pets', '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 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);\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 review_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: ['list', '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_votes_funny text, -- example: ['Low', 'None']\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 Days (\n day_id integer, -- example: [1, 2]\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:\nactive business refers to active = 'true'; 'Pets' is the category_name\nList the active business ID and its stars of the businesses fall under the category of Pets.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T3.category_name LIKE 'Pets'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.business_id, T1.stars FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T3.category_name LIKE 'Pets'", "index": 1909, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_1 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 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 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 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 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 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_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: ['Pets', '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 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);\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 review_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: ['list', '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_votes_funny text, -- example: ['Low', 'None']\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 Days (\n day_id integer, -- example: [1, 2]\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:\nactive business refers to active = 'true'; 'Pets' is the category_name\nList the active business ID and its stars of the businesses fall under the category of Pets.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 tip_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_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 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 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_2 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 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_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\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 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:\nhighest star rating Max(stars); attribute of business refers to attribute_name\nWhat is the attribute of the business 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 T3.attribute_name 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 ORDER BY T1.stars DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.attribute_name 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 ORDER BY T1.stars DESC LIMIT 1", "index": 1910, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 tip_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_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 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 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_2 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 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_funny text, -- example: ['None', 'Low']\n review_votes_useful text, -- example: ['None', 'Low']\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 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:\nhighest star rating Max(stars); attribute of business refers to attribute_name\nWhat is the attribute of the business 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 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_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 city text, -- example: ['Gilbert', '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 Compliments (\n compliment_id integer, -- example: [1, 2]\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_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 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 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 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_4 text, -- example: ['None', 'Low']\n label_time_5 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_12 text, -- example: ['None', 'Low']\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 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 PRIMARY KEY (business_id, day_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_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 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 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:\n\"Gilbert\" is the name of city; highest star rating refers to Max(stars)\nWhat is the closing and opening time of businesses located at Gilbert 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.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 LIKE 'Gilbert' ORDER BY T1.stars DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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 LIKE 'Gilbert' ORDER BY T1.stars DESC LIMIT 1", "index": 1911, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 city text, -- example: ['Gilbert', '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 Compliments (\n compliment_id integer, -- example: [1, 2]\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_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 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 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 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_4 text, -- example: ['None', 'Low']\n label_time_5 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_12 text, -- example: ['None', 'Low']\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 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 PRIMARY KEY (business_id, day_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_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 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 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:\n\"Gilbert\" is the name of city; highest star rating refers to Max(stars)\nWhat is the closing and opening time of businesses located at Gilbert 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\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 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 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 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: ['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 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_4 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_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 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);\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 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 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_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 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:\ninactive business refers to active = 'FALSE'; 'AZ' is the state; category refers to category_name\nList the categories of inactive businesses in 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 T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'FALSE' AND T1.state LIKE 'AZ'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'FALSE' AND T1.state LIKE 'AZ'", "index": 1912, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['false', 'true']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\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 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 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 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: ['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 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_4 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_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 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);\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 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 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_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 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:\ninactive business refers to active = 'FALSE'; 'AZ' is the state; category refers to category_name\nList the categories of inactive businesses in 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: ['Saturday', '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_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_6 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_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_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 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 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 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 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 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 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: ['9PM', '9AM', '11AM', '12PM']\n closing_time text, -- example: ['9PM', '9AM', '8PM']\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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_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 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 attribute_value text, -- example: ['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:\n9 am refers to opening_time = '9AM'; 9 pm refers to closing_time = '9PM'; every Saturday refers to day_of_week = 'Saturday'; location refers to city\nFind the location of businesses that has business hours from 9 am to 9 pm every Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.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.closing_time LIKE '9PM' AND T2.opening_time LIKE '9AM' AND T3.day_of_week LIKE 'Saturday' GROUP BY T1.city", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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.closing_time LIKE '9PM' AND T2.opening_time LIKE '9AM' AND T3.day_of_week LIKE 'Saturday' GROUP BY T1.city", "index": 1913, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Saturday', '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_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_6 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_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_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 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 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 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 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 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 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: ['9PM', '9AM', '11AM', '12PM']\n closing_time text, -- example: ['9PM', '9AM', '8PM']\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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\n PRIMARY KEY (compliment_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 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 attribute_value text, -- example: ['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:\n9 am refers to opening_time = '9AM'; 9 pm refers to closing_time = '9PM'; every Saturday refers to day_of_week = 'Saturday'; location refers to city\nFind the location of businesses that has business hours from 9 am to 9 pm every Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 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 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 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 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_4 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_16 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 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 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_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 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_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', '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:\nactive business refers to active = 'true';  'Scottsdale' is the name of city; stars greater than the 60% of average age of star rating refers to stars  > avg(stars) * 60%\nList the closing time and day of week of active businesses in Scottsdale with stars greater than the 60% of average age of 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.closing_time, T3.day_of_week 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 LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' AND T1.stars > 0.6 * ( SELECT AVG(T1.stars) 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 LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' )", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.closing_time, T3.day_of_week 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 LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' AND T1.stars > 0.6 * ( SELECT AVG(T1.stars) 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 LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' )", "index": 1914, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 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 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 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 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_4 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_16 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 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 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_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 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_Attributes (\n attribute_id integer, -- example: [1, 2]\n business_id integer, -- example: [2, 3]\n attribute_value text, -- example: ['average', '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:\nactive business refers to active = 'true';  'Scottsdale' is the name of city; stars greater than the 60% of average age of star rating refers to stars  > avg(stars) * 60%\nList the closing time and day of week of active businesses in Scottsdale with stars greater than the 60% of average age of 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_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 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 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: ['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 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: ['list', '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_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 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 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 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 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_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 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_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_16 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 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 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_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:\nless than 5 low compliment refers to number_of_compliments < 5\nList at least 5 users that has received less than 5 low compliments from\nother 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 user_id FROM Users_Compliments WHERE number_of_compliments LIKE 'Low' GROUP BY user_id ORDER BY COUNT(number_of_compliments) > 5 LIMIT 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT user_id FROM Users_Compliments WHERE number_of_compliments LIKE 'Low' GROUP BY user_id ORDER BY COUNT(number_of_compliments) > 5 LIMIT 5", "index": 1915, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 attribute_value text, -- example: ['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 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: ['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 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: ['list', '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_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 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 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 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 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_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 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_11 text, -- example: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_16 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 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 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_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:\nless than 5 low compliment refers to number_of_compliments < 5\nList at least 5 users that has received less than 5 low compliments from\nother 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 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 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 (\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_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_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\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 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 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 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 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 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:\n4 as an average rating refers to user_average_stars = 4\nList at least 10 users ID that has 4 as an average ratings of all reviews sent.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_average_stars = 4 LIMIT 10", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(user_id) FROM Users WHERE user_average_stars = 4 LIMIT 10", "index": 1916, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 (\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_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_2 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\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 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 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 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 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 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:\n4 as an average rating refers to user_average_stars = 4\nList at least 10 users ID that has 4 as an average ratings of all reviews sent.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Open 24 Hours', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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 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_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 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 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 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_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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopened for 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'\nHow many businesses are opened for 24 hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Open 24 Hours'", "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 T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Open 24 Hours'", "index": 1917, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Open 24 Hours', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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 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_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 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 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 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_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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopened for 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'\nHow many businesses are opened for 24 hours?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Good For Dancing', 'Good For Groups', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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 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 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 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 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_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 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_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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Good for Groups\" and \"Good for Dancing\" are attribute_name; active business refers to active = true'\nList at least 5 active business ID that are good for groups and dancing.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.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 T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Good for Dancing' AND T1.attribute_name LIKE 'Good for Groups' LIMIT 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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 T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Good for Dancing' AND T1.attribute_name LIKE 'Good for Groups' LIMIT 5", "index": 1918, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Good For Dancing', 'Good For Groups', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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 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 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 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 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_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 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_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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Good for Groups\" and \"Good for Dancing\" are attribute_name; active business refers to active = true'\nList at least 5 active business ID that are good for groups and dancing.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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_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 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_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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Ahwatukee', '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 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_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_yelping_since_year integer, -- example: [2012, 2010]\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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 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 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 attribute_value text, -- example: ['true', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business refers to active = 'true'; 'Ahwatukee' is the name of city; open in Sunday refers to day_of_week = 'Sunday'\nAmong the active businesses in Ahwatukee, which of them are still open in Sunday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.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 LIKE 'Ahwatukee' AND T1.active LIKE 'TRUE' AND T3.day_of_week LIKE 'Sunday'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.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 LIKE 'Ahwatukee' AND T1.active LIKE 'TRUE' AND T3.day_of_week LIKE 'Sunday'", "index": 1919, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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_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 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_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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Ahwatukee', '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 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_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_yelping_since_year integer, -- example: [2012, 2010]\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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 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 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 attribute_value text, -- example: ['true', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive business refers to active = 'true'; 'Ahwatukee' is the name of city; open in Sunday refers to day_of_week = 'Sunday'\nAmong the active businesses in Ahwatukee, which of them are still open in Sunday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 state text, -- example: ['AZ', 'SC']\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 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 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_6 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\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 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 Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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_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 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_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 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 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:\nactive business refers to active = 'true'; not in Arizona refers to state ! = 'AZ'; category refers to category_name\nList the categories of all active businesses that were not in Arizona.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T1.state NOT LIKE 'AZ'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.active LIKE 'TRUE' AND T1.state NOT LIKE 'AZ'", "index": 1920, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 state text, -- example: ['AZ', 'SC']\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 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 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_6 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\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 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 Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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_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 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_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 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 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:\nactive business refers to active = 'true'; not in Arizona refers to state ! = 'AZ'; category refers to category_name\nList the categories of all active businesses that were not in Arizona.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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_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_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['High', 'None', 'Low']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_13 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_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 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 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 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 user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (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 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_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:\nhigh review count refers to review_count = 'High'; received 2 stars refers to stars = 2; category refers to category_name\nList the category of the business with high review count but received 2 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 T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars = 2 AND T1.review_count LIKE 'High'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars = 2 AND T1.review_count LIKE 'High'", "index": 1921, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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_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_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['High', 'None', 'Low']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_13 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_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 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 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 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 user_votes_cool text, -- example: ['Low', 'Uber']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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: ['High', 'Low', 'Medium']\n PRIMARY KEY (business_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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (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 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_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:\nhigh review count refers to review_count = 'High'; received 2 stars refers to stars = 2; category refers to category_name\nList the category of the business with high review count but received 2 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['6PM', '1PM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '1PM', '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 attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Sunday', 'Monday']\n PRIMARY KEY (day_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 number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_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 (\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 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_2 text, -- example: ['None', 'Low']\n label_time_4 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_14 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 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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year 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 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 likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1 pm refers to opening_time = '1PM'; 6 pm refers to closing_time = '6PM'; on Saturday refers to day_of_week = 'Saturday'\nList the city of the business where they open from 1 pm to 6 pm on Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.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.closing_time LIKE '6PM' AND T2.opening_time LIKE '1PM' AND T3.day_of_week LIKE 'Saturday'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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.closing_time LIKE '6PM' AND T2.opening_time LIKE '1PM' AND T3.day_of_week LIKE 'Saturday'", "index": 1922, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['6PM', '1PM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '1PM', '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 attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Sunday', 'Monday']\n PRIMARY KEY (day_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 number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_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 (\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 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_2 text, -- example: ['None', 'Low']\n label_time_4 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_14 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 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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year 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 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 likes integer, -- example: [0, 1]\n PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1 pm refers to opening_time = '1PM'; 6 pm refers to closing_time = '6PM'; on Saturday refers to day_of_week = 'Saturday'\nList the city of the business where they open from 1 pm to 6 pm on Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Saturday', '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 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: ['12AM', '1AM', '11AM', '12PM']\n closing_time text, -- example: ['12AM', '1AM', '8PM', '9PM']\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: ['High', '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_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['High', 'Low', 'None']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_14 text, -- example: ['High', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 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 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 (\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: ['High', '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 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_funny text, -- example: ['Low', 'None']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (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);\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_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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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:\n12 am refers to opening_time = '12AM'; 1 am refers to closing_time = '1AM'; on Saturday refers to day_of_week = 'Saturday'\nWhat city does the business came from where they received a high volume of check-ins from 12 am to 1 am on Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.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.closing_time = '1AM' AND T2.opening_time = '12AM' AND T3.day_of_week = 'Saturday'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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.closing_time = '1AM' AND T2.opening_time = '12AM' AND T3.day_of_week = 'Saturday'", "index": 1923, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Saturday', '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 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: ['12AM', '1AM', '11AM', '12PM']\n closing_time text, -- example: ['12AM', '1AM', '8PM', '9PM']\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: ['High', '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_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['High', 'Low', 'None']\n label_time_12 text, -- example: ['High', 'None', 'Low']\n label_time_14 text, -- example: ['High', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 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 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 (\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: ['High', '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 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_funny text, -- example: ['Low', 'None']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (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);\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_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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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:\n12 am refers to opening_time = '12AM'; 1 am refers to closing_time = '1AM'; on Saturday refers to day_of_week = 'Saturday'\nWhat city does the business came from where they received a high volume of check-ins from 12 am to 1 am on Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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: ['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: ['Shopping Centers', 'Shopping', '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_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 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_1 text, -- example: ['High', '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_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: ['High', 'Low', 'None']\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_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 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 Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['High', '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 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 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:\n\"Shopping Centers\" is the category_name; high review count refers to review_count = 'High'\nHow many businesses have shopping centers and received 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(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name = 'Shopping Centers' AND T3.review_count = 'High'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name = 'Shopping Centers' AND T3.review_count = 'High'", "index": 1924, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 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: ['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: ['Shopping Centers', 'Shopping', '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_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 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_1 text, -- example: ['High', '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_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: ['High', 'Low', 'None']\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_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 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 Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['High', '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 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 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:\n\"Shopping Centers\" is the category_name; high review count refers to review_count = 'High'\nHow many businesses have shopping centers and received 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['CA', 'SC', 'AZ']\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 attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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 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 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);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 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 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_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 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_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_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\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_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"South Carolina\" and \"California\" are both state; average review stars from users = Divide((Sum(review_stars(state = 'SC')) + Sum(review_stars(state = 'CA'))), Sum(stars))\nCalculate the average review star from users in businesses located in South Carolina and California 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 1.0 * (( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'SC' ) + ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'CA' )) / ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ) AS reslut", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 1.0 * (( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'SC' ) + ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'CA' )) / ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ) AS reslut", "index": 1925, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Phoenix', 'Scottsdale']\n state text, -- example: ['CA', 'SC', 'AZ']\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 attribute_value text, -- example: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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 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 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);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 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 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_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 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_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_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\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_15 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"South Carolina\" and \"California\" are both state; average review stars from users = Divide((Sum(review_stars(state = 'SC')) + Sum(review_stars(state = 'CA'))), Sum(stars))\nCalculate the average review star from users in businesses located in South Carolina and California 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_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 PRIMARY KEY (category_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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', '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 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_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 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_4 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_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 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 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 tip_length text, -- example: ['Medium', 'Short']\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: ['true', 'none', 'full_bar']\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 Users (\n user_id integer, -- example: [1, 2]\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:\nactively running business refers to active = 'true'; 'Phoenix' is the name of city\nHow many actively running Yelp businesses are there located in \"Phoenix\" city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Phoenix'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Phoenix'", "index": 1926, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', '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 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_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 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_4 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_13 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_15 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 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 tip_length text, -- example: ['Medium', 'Short']\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: ['true', 'none', 'full_bar']\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 Users (\n user_id integer, -- example: [1, 2]\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:\nactively running business refers to active = 'true'; 'Phoenix' is the name of city\nHow many actively running Yelp businesses are there located in \"Phoenix\" city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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_6 text, -- example: ['None', 'Low']\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_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: ['Mesa', '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 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 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);\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_cool text, -- example: ['Low', 'Uber']\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 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 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_useful text, -- example: ['None', 'Low']\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 PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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:\n\"4\" stars refers to stars = '4'; 'Mesa' is the name of city\nGive the number of \"4\" stars Yelp businesses in \"Mesa\" city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(business_id) FROM Business WHERE stars = 4 AND city = 'Mesa'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE stars = 4 AND city = 'Mesa'", "index": 1927, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\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_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: ['Mesa', '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 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 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);\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_cool text, -- example: ['Low', 'Uber']\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 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 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_useful text, -- example: ['None', 'Low']\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 PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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:\n\"4\" stars refers to stars = '4'; 'Mesa' is the name of city\nGive the number of \"4\" stars Yelp businesses in \"Mesa\" city.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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_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 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 (\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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Gilbert', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Uber', '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 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 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: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 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 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 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:\nactively running business refers to active = 'true'; 'Gilbert' is the name of city; most review refers to review_count = 'Uber'\nWhich actively running Yelp business in \"Gilbert\" has got the most reviews? Give the business id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'true' AND T1.city = 'Gilbert' AND T1.review_count = 'Uber'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'true' AND T1.city = 'Gilbert' AND T1.review_count = 'Uber'", "index": 1928, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\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: ['true', '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);\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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Gilbert', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Uber', '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 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 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: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 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 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 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:\nactively running business refers to active = 'true'; 'Gilbert' is the name of city; most review refers to review_count = 'Uber'\nWhich actively running Yelp business in \"Gilbert\" has got the most reviews? Give the business id.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 category_name text, -- example: ['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_yelping_since_year integer, -- example: [2012, 2010]\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 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 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 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_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: ['Tempe', 'Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Uber', '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 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 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_4 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: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 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 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: ['Long', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Tempe\" is the name of city; long review refers to review_length = 'Long'\nFor the Yelp business in \"Tempe\" city which got \"3.5\" stars and review count as \"Uber\", how many \"long\" reviews did it get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Tempe' AND T1.stars = '3.5' AND T1.review_count = 'Uber' AND T2.review_length = 'Long'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Tempe' AND T1.stars = '3.5' AND T1.review_count = 'Uber' AND T2.review_length = 'Long'", "index": 1929, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 category_name text, -- example: ['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_yelping_since_year integer, -- example: [2012, 2010]\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 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 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 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_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: ['Tempe', 'Phoenix', 'Scottsdale']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Uber', '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 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 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_4 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: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 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 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: ['Long', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Tempe\" is the name of city; long review refers to review_length = 'Long'\nFor the Yelp business in \"Tempe\" city which got \"3.5\" stars and review count as \"Uber\", how many \"long\" reviews did it get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, 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 PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Monday', 'Sunday']\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_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 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: ['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_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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['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 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_votes_funny text, -- example: ['Low', 'None']\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 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:\nYelp business No. 15098 refers to business_id = '15098'; Monday refers to day_of_week = 'Monday'\nHow long is the Yelp business No. 15098 opened on Monday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUBSTR(T1.closing_time, 1, 2) + 12 - SUBSTR(T1.opening_time, 1, 2) AS YYSJ FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week = 'Monday' AND T1.business_id = 15098", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT SUBSTR(T1.closing_time, 1, 2) + 12 - SUBSTR(T1.opening_time, 1, 2) AS YYSJ FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week = 'Monday' AND T1.business_id = 15098", "index": 1930, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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_useful text, -- example: ['None', 'Low']\n review_votes_cool text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, 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 PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Monday', 'Sunday']\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_0 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 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: ['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_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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['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 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_votes_funny text, -- example: ['Low', 'None']\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 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:\nYelp business No. 15098 refers to business_id = '15098'; Monday refers to day_of_week = 'Monday'\nHow long is the Yelp business No. 15098 opened on Monday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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 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 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 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: ['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_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 Business (\n business_id integer, -- example: [1, 2]\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 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 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_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_10 text, -- example: ['Medium', '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_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_16 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_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 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_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\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:\nmedium length tip refers to tip_length = 'Medium';\nWhich city is the business that got a \"medium\" length tip with \"3\" likes located 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 T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Medium' AND T2.likes = 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Medium' AND T2.likes = 3", "index": 1931, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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 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 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 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: ['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_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 Business (\n business_id integer, -- example: [1, 2]\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 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 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_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_10 text, -- example: ['Medium', '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_15 text, -- example: ['Medium', 'None', 'Low']\n label_time_16 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_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 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_Compliments (\n compliment_id integer, -- example: [1, 2]\n user_id integer, -- example: [3, 19]\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:\nmedium length tip refers to tip_length = 'Medium';\nWhich city is the business that got a \"medium\" length tip with \"3\" likes located 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 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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['cool', 'photos']\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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\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 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_6 text, -- example: ['None', 'Low']\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 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 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 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 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 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 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\"cool\" type compliments refers to compliment_type = 'cool'; user No. 41717 refers to user_id = 41717\nHow many \"cool\" type compliments does user No. 41717 get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.number_of_compliments) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'cool' AND T2.user_id = 41717", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.number_of_compliments) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'cool' AND T2.user_id = 41717", "index": 1932, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_votes_useful text, -- example: ['None', 'Low']\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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['cool', 'photos']\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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\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 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_6 text, -- example: ['None', 'Low']\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 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 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 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 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 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 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\"cool\" type compliments refers to compliment_type = 'cool'; user No. 41717 refers to user_id = 41717\nHow many \"cool\" type compliments does user No. 41717 get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['parking_lot', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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_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_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 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 (\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 review_count text, -- example: ['Low', 'Medium']\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_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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Parking', 'Active Life', 'Arts & Entertainment']\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 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 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 opening_time text, -- example: ['11AM', '12PM']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness No.\"11825\" refers to business_id = '12476'; have a \"parking lot\" refers to attribute_value = 'parking_lot'\nDoes Yelp business No.\"11825\" have a \"parking lot\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.business_id = 11825 AND T2.attribute_name = 'parking_lot'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.business_id = 11825 AND T2.attribute_name = 'parking_lot'", "index": 1933, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['parking_lot', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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_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_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 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 (\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 review_count text, -- example: ['Low', 'Medium']\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_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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Parking', 'Active Life', 'Arts & Entertainment']\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 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 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 opening_time text, -- example: ['11AM', '12PM']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness No.\"11825\" refers to business_id = '12476'; have a \"parking lot\" refers to attribute_value = 'parking_lot'\nDoes Yelp business No.\"11825\" have a \"parking lot\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\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 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\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 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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: [\"Women's Clothing\", \"Men's Clothing\", 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_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 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 Business (\n business_id integer, -- example: [1, 2]\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:\n\"Women's Clothing\" Yelp businesses refers to  category_name = 'Women''s Clothing'; \"Men's Clothing\" refers to category_name = 'Men''s Clothing'; times refers to DIVIDE(COUNT(category_name = 'Women''s Clothing'), COUNT(category_name = 'Men''s Clothing'))\nHow many times is the number of \"Women's Clothing\" Yelp businesses to \"Men's Clothing\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T2.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) AS TIMES FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) AS TIMES FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id", "index": 1934, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\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 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\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 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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: [\"Women's Clothing\", \"Men's Clothing\", 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_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 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 Business (\n business_id integer, -- example: [1, 2]\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:\n\"Women's Clothing\" Yelp businesses refers to  category_name = 'Women''s Clothing'; \"Men's Clothing\" refers to category_name = 'Men''s Clothing'; times refers to DIVIDE(COUNT(category_name = 'Women''s Clothing'), COUNT(category_name = 'Men''s Clothing'))\nHow many times is the number of \"Women's Clothing\" Yelp businesses to \"Men's Clothing\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['CA', 'AZ', 'SC']\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 (\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 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: ['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 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: ['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 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 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_1 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_13 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_19 text, -- example: ['None', 'Low']\n label_time_22 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 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 attribute_value text, -- example: ['false', '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:\nthe ID refers to business_id; active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is closed or not running now\nWrite down the ID, active status and city of the business which are in CA 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 business_id, active, city FROM Business WHERE state = 'CA' AND active = 'true'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT business_id, active, city FROM Business WHERE state = 'CA' AND active = 'true'", "index": 1935, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['CA', 'AZ', 'SC']\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 (\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 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: ['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 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: ['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 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 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_1 text, -- example: ['None', 'Low']\n label_time_4 text, -- example: ['None', 'Low']\n label_time_13 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_19 text, -- example: ['None', 'Low']\n label_time_22 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 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 attribute_value text, -- example: ['false', '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:\nthe ID refers to business_id; active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is closed or not running now\nWrite down the ID, active status and city of the business which are in CA 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 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 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 opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_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 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_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\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_11 text, -- example: ['Low', 'None']\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 label_time_21 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 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 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 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 PRIMARY KEY (user_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute name which start with \"music\" refers to attribute_name LIKE 'music%'\nAmong all attribute names, list down the ID and attribute name which start with \"music\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT attribute_id, attribute_name FROM Attributes WHERE attribute_name LIKE 'music%'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT attribute_id, attribute_name FROM Attributes WHERE attribute_name LIKE 'music%'", "index": 1936, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 opening_time text, -- example: ['11AM', '12PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_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 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_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_id, 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\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_11 text, -- example: ['Low', 'None']\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 label_time_21 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 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 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 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 PRIMARY KEY (user_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute name which start with \"music\" refers to attribute_name LIKE 'music%'\nAmong all attribute names, list down the ID and attribute name which start with \"music\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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_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_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 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_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 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 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_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_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 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 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 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', 'cool', 'photos']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngot uber for cool votes refers to review_votes_cool = 'Uber'\nList down the business ID and user ID who got uber for cool 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 business_id, user_id FROM Reviews WHERE review_votes_cool = 'Uber'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT business_id, user_id FROM Reviews WHERE review_votes_cool = 'Uber'", "index": 1937, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['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_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_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 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_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 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 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_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_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 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 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 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', 'cool', 'photos']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngot uber for cool votes refers to review_votes_cool = 'Uber'\nList down the business ID and user ID who got uber for cool 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\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 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 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 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 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_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_11 text, -- example: ['High', 'Low', 'None']\n label_time_12 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_17 text, -- example: ['Low', 'None']\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 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: ['none', 'full_bar']\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 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_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 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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 Days (\n day_id integer, -- example: [1, 2]\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:\nstarted using Yelp since 2004 refers to user_yelping_since_year = '2004'; had high followers refers to user_fans = 'High'\nWrite the user ID, business ID and tips length of who started using Yelp since 2004 and had high followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id, T2.business_id, T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_fans = 'High'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.user_id, T2.business_id, T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_fans = 'High'", "index": 1938, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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_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_11 text, -- example: ['High', 'Low', 'None']\n label_time_12 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_17 text, -- example: ['Low', 'None']\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 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: ['none', 'full_bar']\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 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_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 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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\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 Days (\n day_id integer, -- example: [1, 2]\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:\nstarted using Yelp since 2004 refers to user_yelping_since_year = '2004'; had high followers refers to user_fans = 'High'\nWrite the user ID, business ID and tips length of who started using Yelp since 2004 and had high followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['Long', '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 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_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', '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 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 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_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 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 user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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 review_count text, -- example: ['Uber', 'Low', 'Medium']\n PRIMARY KEY (business_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: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['funny', 'cool', 'photos']\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 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 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:\nreview votes of funny refers to review_votes_funny = 'Uber'; cool hit uber refers to review_votes_cool = 'Uber'; user year of joining Yelp refers to user_yelping_since_year\nAmong the review votes of funny and cool hit uber with long review length, describe the business ID, active status, user ID and user year of joining Yelp.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id, T1.active, T3.user_id, T3.user_yelping_since_year FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.review_votes_cool = 'Uber' AND T2.review_votes_funny = 'Uber' AND T2.review_length = 'Long'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.business_id, T1.active, T3.user_id, T3.user_yelping_since_year FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.review_votes_cool = 'Uber' AND T2.review_votes_funny = 'Uber' AND T2.review_length = 'Long'", "index": 1939, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['Long', '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 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_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', '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 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 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_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 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 user_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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 review_count text, -- example: ['Uber', 'Low', 'Medium']\n PRIMARY KEY (business_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: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['funny', 'cool', 'photos']\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 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 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:\nreview votes of funny refers to review_votes_funny = 'Uber'; cool hit uber refers to review_votes_cool = 'Uber'; user year of joining Yelp refers to user_yelping_since_year\nAmong the review votes of funny and cool hit uber with long review length, describe the business ID, active status, user ID and user year of joining Yelp.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['music_playlist', '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 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 (\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 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_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_10 text, -- example: ['None', 'Low']\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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\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 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: ['false', 'true', '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 PRIMARY KEY (compliment_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status refers to active; active = 'true' means the business is still running; active = 'false' means the business is inactive or not running now\nUnder the attribute name of \"music_playlist\", describe the attribute ID, business ID, city and inactive status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.attribute_id, T2.business_id, T3.city 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_playlist' AND T3.active = 'false'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.attribute_id, T2.business_id, T3.city 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_playlist' AND T3.active = 'false'", "index": 1940, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\n PRIMARY KEY (business_id, day_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['music_playlist', '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 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 (\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 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_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_10 text, -- example: ['None', 'Low']\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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\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 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: ['false', 'true', '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 PRIMARY KEY (compliment_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive status refers to active; active = 'true' means the business is still running; active = 'false' means the business is inactive or not running now\nUnder the attribute name of \"music_playlist\", describe the attribute ID, business ID, city and inactive status.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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: ['Accepts Credit Cards', '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_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_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\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 attribute_value text, -- example: ['none', 'full_bar']\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 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 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 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 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_6 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_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:\npercentage refers to DIVIDE(COUNT(attribute_name = 'Accepts Credit Cards'), COUNT(business_id))*100%\nCalculate the percentage of business with attribute name of \"Accepts Credit Cards\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.attribute_name = 'Accepts Credit Cards' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.attribute_name) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.attribute_name = 'Accepts Credit Cards' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.attribute_name) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id", "index": 1941, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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: ['Accepts Credit Cards', '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_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_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\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 attribute_value text, -- example: ['none', 'full_bar']\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 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 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 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 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_6 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_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:\npercentage refers to DIVIDE(COUNT(attribute_name = 'Accepts Credit Cards'), COUNT(business_id))*100%\nCalculate the percentage of business with attribute name of \"Accepts Credit Cards\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 likes integer, -- example: [0, 1]\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_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 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 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 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 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 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 actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (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 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: ['Sun Lakes', '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_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_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Lakes', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith great experience refers to stars = 5\nFor the business with great experience existed in Sun Lakes city, provide the user ID who gave review on it and user followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id, T3.user_fans FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.city = 'Sun Lakes' AND T1.stars = 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.user_id, T3.user_fans FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.city = 'Sun Lakes' AND T1.stars = 5", "index": 1942, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 likes integer, -- example: [0, 1]\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_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 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 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 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 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 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 actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (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 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: ['Sun Lakes', '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_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_10 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Lakes', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwith great experience refers to stars = 5\nFor the business with great experience existed in Sun Lakes city, provide the user ID who gave review on it and user followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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);\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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 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 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_4 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_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\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 (\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 review_count text, -- example: ['Uber', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quality user refers to number_of_compliments = 'Uber'; user of under ID 100 refers to user_id < 100 ;\nAmong highest quality user of under ID 100, mention compliment type which got highest compliment number and user's followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.compliment_type, T3.user_fans FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.number_of_compliments = 'Uber' AND T2.user_id < 100", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.compliment_type, T3.user_fans FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.number_of_compliments = 'Uber' AND T2.user_id < 100", "index": 1943, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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 user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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);\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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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 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 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_4 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_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\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 (\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 review_count text, -- example: ['Uber', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest quality user refers to number_of_compliments = 'Uber'; user of under ID 100 refers to user_id < 100 ;\nAmong highest quality user of under ID 100, mention compliment type which got highest compliment number and user's followers.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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: ['Medium', 'Short']\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 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 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 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 closing_time text, -- example: ['8PM', '9PM']\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_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 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_3 text, -- example: ['None', 'Low']\n label_time_4 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_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_18 text, -- example: ['None', 'Low']\n label_time_19 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 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 attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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:\nclosed at 8PM refers to closing_time = '8PM';\nList all the businesses that closed at 8PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 business_id FROM Business_Hours WHERE closing_time = '8PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT business_id FROM Business_Hours WHERE closing_time = '8PM'", "index": 1944, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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: ['Medium', 'Short']\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 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 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 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 closing_time text, -- example: ['8PM', '9PM']\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_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 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_3 text, -- example: ['None', 'Low']\n label_time_4 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_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_18 text, -- example: ['None', 'Low']\n label_time_19 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 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 attribute_value text, -- example: ['none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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:\nclosed at 8PM refers to closing_time = '8PM';\nList all the businesses that closed at 8PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 city text, -- example: ['Phoenix ', '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 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 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 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 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 Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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 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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated in Phoenix refers to city = 'Phoenix'; Arizona refers to state = 'AZ'\nHow many 2 stars rated business located in Phoenix, Arizona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 = 'Phoenix' AND state = 'AZ' AND stars = 2", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND state = 'AZ' AND stars = 2", "index": 1945, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 city text, -- example: ['Phoenix ', '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 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 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 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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_3 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 Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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 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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocated in Phoenix refers to city = 'Phoenix'; Arizona refers to state = 'AZ'\nHow many 2 stars rated business located in Phoenix, Arizona?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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);\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 Years (\n year_id 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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (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 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_5 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_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_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 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_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 (\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage star less than 3 stars refers to user_average_stars < 3; in 2012 refers to user_yelping_since_year = 2012\nList all the users with average star less than 3 stars in 2012\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT user_id FROM Users WHERE user_yelping_since_year = 2012 AND user_average_stars < 3", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT user_id FROM Users WHERE user_yelping_since_year = 2012 AND user_average_stars < 3", "index": 1946, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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);\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 Years (\n year_id 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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (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 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_5 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_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_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 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_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 (\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage star less than 3 stars refers to user_average_stars < 3; in 2012 refers to user_yelping_since_year = 2012\nList all the users with average star less than 3 stars in 2012\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_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 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\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 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 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_6 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2012 refers to actual_year = 2012;\nWhich users become an elite in 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT T1.user_id FROM Elite AS T1 INNER JOIN Years AS T2 ON T1.year_id = T2.year_id WHERE T2.actual_year = 2012", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T1.user_id FROM Elite AS T1 INNER JOIN Years AS T2 ON T1.year_id = T2.year_id WHERE T2.actual_year = 2012", "index": 1947, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_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 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\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 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 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_6 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\n label_time_13 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 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2012 refers to actual_year = 2012;\nWhich users become an elite in 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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: ['Shopping', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (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);\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_1 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 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 PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\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 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 closing_time text, -- example: ['8PM', '9PM']\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 Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\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 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 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 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:\nshopping business refers to category_name = 'Shopping'; 4 stars ratings refers to stars = 4\nList the business ID of shopping business that have 4 stars ratings.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT 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 = 'Shopping' AND T1.stars = 4", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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 = 'Shopping' AND T1.stars = 4", "index": 1948, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\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: ['Shopping', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (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);\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_1 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_16 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_20 text, -- example: ['None', 'Low']\n label_time_22 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 PRIMARY KEY (attribute_id, business_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\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 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 closing_time text, -- example: ['8PM', '9PM']\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 Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\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 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 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 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:\nshopping business refers to category_name = 'Shopping'; 4 stars ratings refers to stars = 4\nList the business ID of shopping business that have 4 stars ratings.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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: ['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 number_of_compliments text, -- example: ['Medium', 'Low']\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 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 compliment_type text, -- example: ['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: ['Low', 'None']\n label_time_1 text, -- example: ['Low', 'None']\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: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_16 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 (\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_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\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_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: ['10AM', '11AM', '12PM']\n closing_time text, -- example: ['10AM', '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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non Sunday refers to day_of_week = 'Sunday'; low check-in at 10AM refers to label_time_10 = 'Low'\nHow many business have low check-in on Sunday at 10AM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Days AS T1 INNER JOIN Checkins AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday' AND T2.label_time_10 = 'Low'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.business_id) FROM Days AS T1 INNER JOIN Checkins AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday' AND T2.label_time_10 = 'Low'", "index": 1949, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\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 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 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 number_of_compliments text, -- example: ['Medium', 'Low']\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 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 compliment_type text, -- example: ['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: ['Low', 'None']\n label_time_1 text, -- example: ['Low', 'None']\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: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_15 text, -- example: ['Low', 'None']\n label_time_16 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 (\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_useful text, -- example: ['Low', 'Medium']\n user_review_count text, -- example: ['Medium', 'High']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\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_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: ['10AM', '11AM', '12PM']\n closing_time text, -- example: ['10AM', '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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non Sunday refers to day_of_week = 'Sunday'; low check-in at 10AM refers to label_time_10 = 'Low'\nHow many business have low check-in on Sunday at 10AM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 attribute_value text, -- example: ['none', 'full_bar']\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_1 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_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_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_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 category_name text, -- example: ['Active Life', 'Arts & Entertainment']\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 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 tip_length text, -- example: ['Medium', 'Short']\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_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_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: ['Glendale', 'Glendale Az', '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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (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 Users (\n user_id integer, -- example: [1, 2]\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 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:\nin Glendale refers to city = 'Glendale'\nHow many businesses in Glendale are reviewed by user with the ID of 20241?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' AND T2.user_id = 20241", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' AND T2.user_id = 20241", "index": 1950, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 attribute_value text, -- example: ['none', 'full_bar']\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_1 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_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_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_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 category_name text, -- example: ['Active Life', 'Arts & Entertainment']\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 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 tip_length text, -- example: ['Medium', 'Short']\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_useful text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\n PRIMARY KEY (business_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: ['Glendale', 'Glendale Az', '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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year integer, -- example: [2005, 2006]\n PRIMARY KEY (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 Users (\n user_id integer, -- example: [1, 2]\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 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:\nin Glendale refers to city = 'Glendale'\nHow many businesses in Glendale are reviewed by user with the ID of 20241?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Pet Services', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (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 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_4 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\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 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:\nlocation refers to city; Pet Services business refers to category_name = 'Pet Services'\nState the locations of all Pet Services business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T1.city 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 = 'Pet Services'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.city 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 = 'Pet Services'", "index": 1951, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Scottsdale']\n PRIMARY KEY (business_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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Pet Services', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (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 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_4 text, -- example: ['None', 'Low']\n label_time_11 text, -- example: ['Low', 'None']\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 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:\nlocation refers to city; Pet Services business refers to category_name = 'Pet Services'\nState the locations of all Pet Services business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny 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 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_9 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 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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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: ['false', '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:\nclosed refers to active = 'false'; more than 10 attributes refers to count(attribute_id) > 10\nHow many closed businesses that have more than 10 attributes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business WHERE business_id IN ( SELECT T1.business_id FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'false' GROUP BY T1.business_id HAVING COUNT(DISTINCT T2.attribute_id) > 10 )", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(*) FROM Business WHERE business_id IN ( SELECT T1.business_id FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'false' GROUP BY T1.business_id HAVING COUNT(DISTINCT T2.attribute_id) > 10 )", "index": 1952, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['false', 'true']\n stars real, -- example: [3.0, 4.5]\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_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 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny 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 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_9 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 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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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: ['false', '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:\nclosed refers to active = 'false'; more than 10 attributes refers to count(attribute_id) > 10\nHow many closed businesses that have more than 10 attributes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Phoenix ', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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 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 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 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_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\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 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 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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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:\nin Chandelier refers to city = 'Chandelier'; percentage = divide(count(business_id where review_votes_funny = 'Low'), count(business_id)); business with low funny votes refers to review_votes_funny = 'Low'\nBased on business in Phoenix, calculate the percentage of business with low funny 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 CAST(SUM(CASE WHEN T2.review_votes_funny = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Phoenix'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.review_votes_funny = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Phoenix'", "index": 1953, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Phoenix', 'Phoenix ', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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 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 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 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_8 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\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 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 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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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:\nin Chandelier refers to city = 'Chandelier'; percentage = divide(count(business_id where review_votes_funny = 'Low'), count(business_id)); business with low funny votes refers to review_votes_funny = 'Low'\nBased on business in Phoenix, calculate the percentage of business with low funny 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 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 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 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: ['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_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);\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);\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_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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\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 (\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 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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Shopping', 'Pets', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = divide(count(business_id where category_name = 'Shopping'), count(business_id where category_name = 'Pets'))\nWhat is the ratio between business in shopping category and business in pets 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(CASE WHEN T2.category_name = 'Shopping' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Pets' THEN 1 ELSE 0 END) AS radio FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T2.category_name = 'Shopping' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Pets' THEN 1 ELSE 0 END) AS radio FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id", "index": 1954, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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: ['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_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);\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);\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_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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'cool']\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 (\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 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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Shopping', 'Pets', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nratio = divide(count(business_id where category_name = 'Shopping'), count(business_id where category_name = 'Pets'))\nWhat is the ratio between business in shopping category and business in pets 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 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 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 category_name text, -- example: ['Banks & Credit Unions', '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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['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_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_12 text, -- example: ['None', 'Low']\n label_time_13 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_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 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 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 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 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 PRIMARY KEY (business_id, 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:\ncategory refers to category_name\nHow many businesses are registered in the database under 'Banks & Credit Unions' category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name = 'Banks & Credit Unions'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name = 'Banks & Credit Unions'", "index": 1955, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 category_name text, -- example: ['Banks & Credit Unions', '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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['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_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_12 text, -- example: ['None', 'Low']\n label_time_13 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_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 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 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 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 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 PRIMARY KEY (business_id, 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:\ncategory refers to category_name\nHow many businesses are registered in the database under 'Banks & Credit Unions' 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 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 (\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 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 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Casa Grande', '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 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 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 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: ['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:\nactive business refers to active = 'true'; Casa Grande refers to city = 'Casa Grande'\nHow many active businesses from Casa Grande are registered in the database?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 active = 'true' AND city = 'Casa Grande'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Casa Grande'", "index": 1956, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 (\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 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 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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Casa Grande', '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 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 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 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: ['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:\nactive business refers to active = 'true'; Casa Grande refers to city = 'Casa Grande'\nHow many active businesses from Casa Grande are registered in the database?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Monday', 'Sunday']\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 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 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_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 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 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 likes integer, -- example: [0, 1]\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 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 user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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 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_11 text, -- example: ['Low', 'None']\n label_time_12 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_19 text, -- example: ['None', 'Low']\n label_time_22 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopen time refers to opening_time; on Monday refers to day_of_week = 'Monday'; business with ID no. refers to business_id \n\n\nWhat time does the business with ID no.12 open on Monday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.opening_time FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.business_id = 12 AND T2.day_of_week = 'Monday'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.opening_time FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.business_id = 12 AND T2.day_of_week = 'Monday'", "index": 1957, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Monday', 'Sunday']\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 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 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_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 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 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 likes integer, -- example: [0, 1]\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 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 user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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 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_11 text, -- example: ['Low', 'None']\n label_time_12 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_19 text, -- example: ['None', 'Low']\n label_time_22 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopen time refers to opening_time; on Monday refers to day_of_week = 'Monday'; business with ID no. refers to business_id \n\n\nWhat time does the business with ID no.12 open on Monday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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_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 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);\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: ['false', 'true']\n city text, -- example: ['Avondale', '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_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_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_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 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 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 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 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:\nclosed business refers to active = 'false'; in Avondale refers to city = 'Avondale'; 'wonderful experience' rating refers to stars > 3; percentage = divide(count(business_id where stars > 3), count(business_id))*100%\nAmong all closed businesses in Avondale, AZ what percent have obtained a 'wonderful experience' rating of the business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(stars) FROM Business WHERE city = 'Avondale' AND active = 'false'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(stars) FROM Business WHERE city = 'Avondale' AND active = 'false'", "index": 1958, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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_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 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);\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: ['false', 'true']\n city text, -- example: ['Avondale', '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_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_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_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 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 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 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 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:\nclosed business refers to active = 'false'; in Avondale refers to city = 'Avondale'; 'wonderful experience' rating refers to stars > 3; percentage = divide(count(business_id where stars > 3), count(business_id))*100%\nAmong all closed businesses in Avondale, AZ what percent have obtained a 'wonderful experience' rating of the business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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_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 PRIMARY KEY (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_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_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_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 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 PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\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 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 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 tip_length text, -- example: ['Long', 'Medium', 'Short']\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: ['Long', '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:\npercentage = divide(count(business_id where review_length = 'Long' and review_stars = 5), count(business_id)) * 100%; long reviews refers to review_length = 'Long'; 5-star review refers to review_stars = 5\nIdentify the percent of long reviews among all 5-star reviews given to businesses by the Yelp 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 CAST(SUM(CASE WHEN review_length = 'Long' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(review_length) FROM Reviews WHERE review_stars = 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN review_length = 'Long' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(review_length) FROM Reviews WHERE review_stars = 5", "index": 1959, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 PRIMARY KEY (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_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_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_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 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 PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\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 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 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 tip_length text, -- example: ['Long', 'Medium', 'Short']\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: ['Long', '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:\npercentage = divide(count(business_id where review_length = 'Long' and review_stars = 5), count(business_id)) * 100%; long reviews refers to review_length = 'Long'; 5-star review refers to review_stars = 5\nIdentify the percent of long reviews among all 5-star reviews given to businesses by the Yelp 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 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 Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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 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 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 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_5 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_21 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 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_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: ['Short', 'Medium']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort tip refers to tip_length = 'Short'; business category refers to category_name\nHow many short tips were left for the business with ID no.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(business_id) FROM Tips WHERE business_id = 2 AND tip_length = 'Short'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Tips WHERE business_id = 2 AND tip_length = 'Short'", "index": 1960, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Years (\n year_id integer, -- example: [2005, 2006]\n PRIMARY KEY (year_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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 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 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 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_5 text, -- example: ['None', 'Low']\n label_time_14 text, -- example: ['None', 'Low']\n label_time_21 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 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_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: ['Short', 'Medium']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort tip refers to tip_length = 'Short'; business category refers to category_name\nHow many short tips were left for the business with ID no.2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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_3 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_10 text, -- example: ['None', 'Low']\n label_time_13 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_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 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 closing_time text, -- example: ['8PM', '9PM']\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_useful 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);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['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 tip_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 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 attribute_value text, -- example: ['false', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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_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 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_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave no attribute refers to attribute_value in( 'none', 'no', 'false')\nMention the number of businesses that have no any 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(business_id) FROM Business_Attributes WHERE attribute_value IN ('none', 'no', 'false')", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_value IN ('none', 'no', 'false')", "index": 1961, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_1 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_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_13 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_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 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 closing_time text, -- example: ['8PM', '9PM']\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_useful 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);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['false', 'true']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['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 tip_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 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 attribute_value text, -- example: ['false', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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_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 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_Categories (\n business_id integer, -- example: [1, 2]\n category_id integer, -- example: [8, 143]\n PRIMARY KEY (business_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhave no attribute refers to attribute_value in( 'none', 'no', 'false')\nMention the number of businesses that have no any 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 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 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 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 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_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 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: ['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: ['Medium', '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_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 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 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 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 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 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:\nmedium length of review refers to review_length = 'Medium'\nList out city name of businesses which have medium length of review.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_length = 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T1.city FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_length = 'Medium'", "index": 1962, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_review_count text, -- example: ['Medium', 'High']\n user_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (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 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 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_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 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: ['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: ['Medium', '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_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 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 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 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 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 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:\nmedium length of review refers to review_length = 'Medium'\nList out city name of businesses which have medium length of review.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\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 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 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 (\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 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 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: ['Medium', 'High', 'Low']\n PRIMARY KEY (business_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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_1 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 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_10 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_11 text, -- example: ['Medium', 'High', 'Low', 'None']\n label_time_12 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_16 text, -- example: ['Medium', 'High', '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 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 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_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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nis medium refers to user_fans = 'Medium'; high compliments refers to number_of_compliments = 'High'\nAmong the users whose fan is medium, how many users received high compliments 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 COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T2.number_of_compliments = 'High' AND T1.user_fans = 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T2.number_of_compliments = 'High' AND T1.user_fans = 'Medium'", "index": 1963, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\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 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 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 (\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 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 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: ['Medium', 'High', 'Low']\n PRIMARY KEY (business_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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_0 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_1 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 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_10 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_11 text, -- example: ['Medium', 'High', 'Low', 'None']\n label_time_12 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_15 text, -- example: ['Medium', 'High', 'None', 'Low']\n label_time_16 text, -- example: ['Medium', 'High', '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 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 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_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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nis medium refers to user_fans = 'Medium'; high compliments refers to number_of_compliments = 'High'\nAmong the users whose fan is medium, how many users received high compliments 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 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 review_length text, -- example: ['Medium', 'Short']\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_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: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 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_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_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 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 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 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_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 PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Gilbert', '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 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 attribute_value text, -- example: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwithout attribute refers to attribute_value = 'None'; in Gilbert refers to city = 'Gilbert'\nAmong the businesses without attribute, how many businesses located in Gilbert?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Gilbert' AND T1.attribute_value IN ('None', 'no', 'false')", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Gilbert' AND T1.attribute_value IN ('None', 'no', 'false')", "index": 1964, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\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 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: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 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_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_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 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 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 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_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 PRIMARY KEY (category_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Gilbert', '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 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 attribute_value text, -- example: ['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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwithout attribute refers to attribute_value = 'None'; in Gilbert refers to city = 'Gilbert'\nAmong the businesses without attribute, how many businesses located in Gilbert?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\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_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\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_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_22 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 category_name text, -- example: ['Active Life', 'Arts & Entertainment']\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 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_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 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 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: ['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: ['full_bar', 'average', 'none']\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:\naverage rating refers to avg(stars); attribute of full_bar refers to attribute_value = 'full_bar'\nAmong the businesses with average rating, how many business has attribute of full_bar.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'full_bar'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'full_bar'", "index": 1965, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\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_cool text, -- example: ['None', 'Low']\n review_length text, -- example: ['Medium', 'Short']\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_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_22 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 category_name text, -- example: ['Active Life', 'Arts & Entertainment']\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 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_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 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 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: ['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: ['full_bar', 'average', 'none']\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:\naverage rating refers to avg(stars); attribute of full_bar refers to attribute_value = 'full_bar'\nAmong the businesses with average rating, how many business has attribute of full_bar.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\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 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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'list', 'cool']\n PRIMARY KEY (compliment_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 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 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 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 PRIMARY KEY (business_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 Users (\n user_id integer, -- example: [1, 2]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompliment type of photos refers to compliment_type = 'photos'\nList out the user id that has compliment type of photos.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_id FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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'", "index": 1966, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_2 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_5 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\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 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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n compliment_type text, -- example: ['photos', 'list', 'cool']\n PRIMARY KEY (compliment_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 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 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 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 PRIMARY KEY (business_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 Users (\n user_id integer, -- example: [1, 2]\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncompliment type of photos refers to compliment_type = 'photos'\nList out the user id that has compliment type of photos.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Mesa', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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_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 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 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 attribute_value text, -- example: ['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: ['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 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 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 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 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_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_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_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_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);\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(business where city = 'Mesa'), count(business)) * 100%\nCalculate the percentage of businesses who located in Mesa. What is attribute value of these businesses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(COUNT(T1.city) AS REAL) * 100 / ( SELECT COUNT(business_id) FROM Business ), T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(COUNT(T1.city) AS REAL) * 100 / ( SELECT COUNT(business_id) FROM Business ), T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'", "index": 1967, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Mesa', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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_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 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 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 attribute_value text, -- example: ['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: ['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 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 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 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 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_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_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_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_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);\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(business where city = 'Mesa'), count(business)) * 100%\nCalculate the percentage of businesses who located in Mesa. What is attribute value of these businesses.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['12AM', '8PM', '9PM']\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_2 text, -- example: ['None', 'Low']\n label_time_4 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_14 text, -- example: ['None', 'Low']\n label_time_15 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_22 text, -- example: ['None', 'Low']\n label_time_23 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 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 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 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 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 state text, -- example: ['AZ', 'SC']\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 Days (\n day_id integer, -- example: [1, 2]\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:\nstate refers to city\nState the state of businesses which have closing time at 12AM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.closing_time = '12AM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.closing_time = '12AM'", "index": 1968, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n closing_time text, -- example: ['12AM', '8PM', '9PM']\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_2 text, -- example: ['None', 'Low']\n label_time_4 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_14 text, -- example: ['None', 'Low']\n label_time_15 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_22 text, -- example: ['None', 'Low']\n label_time_23 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 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 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 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 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 state text, -- example: ['AZ', 'SC']\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 Days (\n day_id integer, -- example: [1, 2]\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:\nstate refers to city\nState the state of businesses which have closing time at 12AM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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: ['Peoria', '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 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 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: ['beer_and_wine', 'none', 'full_bar']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute of beer_and_wine refers to attribute_value = 'beer_and_wine'; in Peoria refers to city = 'Peoria'\nAmong the businesses which have attribute of beer_and_wine, how many business located in Peoria?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Peoria' AND T1.attribute_value = 'beer_and_wine'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Peoria' AND T1.attribute_value = 'beer_and_wine'", "index": 1969, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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 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: ['Peoria', '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 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 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: ['beer_and_wine', 'none', 'full_bar']\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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nattribute of beer_and_wine refers to attribute_value = 'beer_and_wine'; in Peoria refers to city = 'Peoria'\nAmong the businesses which have attribute of beer_and_wine, how many business located in Peoria?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_cool text, -- example: ['None', 'Low']\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 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 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 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_11 text, -- example: ['Low', 'None']\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_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_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 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 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);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\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 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 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:\nyear has the most elite users refers to year_id with MAX(user_id);\nWhich year has the most elite 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 year_id FROM Elite GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT year_id FROM Elite GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1", "index": 1970, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_cool text, -- example: ['None', 'Low']\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 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 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 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_11 text, -- example: ['Low', 'None']\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_22 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_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 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 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);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n user_votes_funny text, -- example: ['Low', 'None']\n user_votes_useful text, -- example: ['Low', 'Medium']\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 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 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:\nyear has the most elite users refers to year_id with MAX(user_id);\nWhich year has the most elite 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 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 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 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 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_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_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\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 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 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 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:\nbusinesses refer to business_id; review_stars = 5.0; review_votes_funny = 'uber';\nHow many 5 star businesses have uber review votes for funny?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Reviews WHERE review_stars = 5 AND review_votes_funny = 'Uber'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(business_id) FROM Reviews WHERE review_stars = 5 AND review_votes_funny = 'Uber'", "index": 1971, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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_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_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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 PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\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 Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\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 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 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 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:\nbusinesses refer to business_id; review_stars = 5.0; review_votes_funny = 'uber';\nHow many 5 star businesses have uber review votes for funny?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\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_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 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 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 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 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_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 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 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 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 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 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:\nopened all the time refers to Business_Hours where day_id BETWEEN 1 and 7 and opening_time = closing_time;\nFind out which business ID are opened all the time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT DISTINCT business_id FROM Business_Hours WHERE day_id >= 1 AND day_id < 8 AND opening_time = closing_time", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT business_id FROM Business_Hours WHERE day_id >= 1 AND day_id < 8 AND opening_time = closing_time", "index": 1972, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\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_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 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 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 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 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_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 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 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 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 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 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:\nopened all the time refers to Business_Hours where day_id BETWEEN 1 and 7 and opening_time = closing_time;\nFind out which business ID are opened all the time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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_average_stars text, -- example: ['4.0', '2.5']\n user_votes_useful text, -- example: ['Low', 'Medium']\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: ['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_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 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_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 Business (\n business_id integer, -- example: [1, 2]\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: ['Uber', '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_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', '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 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_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_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:\nusers refer to user_id; uber votes for all of the review category refer to review_votes_funny = 'uber' AND review_votes_useful = 'uber' AND review_votes_cool = 'uber';\nHow many users manage to get uber votes for all of the review category? Find out what are the user average star.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(T2.user_id) AS USER_IDS, T2.user_average_stars FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.review_votes_funny = 'Uber' AND T1.review_votes_useful = 'Uber' AND T1.review_votes_cool = 'Uber'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(T2.user_id) AS USER_IDS, T2.user_average_stars FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.review_votes_funny = 'Uber' AND T1.review_votes_useful = 'Uber' AND T1.review_votes_cool = 'Uber'", "index": 1973, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 PRIMARY KEY (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_votes_useful text, -- example: ['Low', 'Medium']\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: ['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_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 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_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 Business (\n business_id integer, -- example: [1, 2]\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: ['Uber', '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_6 text, -- example: ['None', 'Low']\n label_time_8 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', '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 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_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_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:\nusers refer to user_id; uber votes for all of the review category refer to review_votes_funny = 'uber' AND review_votes_useful = 'uber' AND review_votes_cool = 'uber';\nHow many users manage to get uber votes for all of the review category? Find out what are the user average star.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 Categories (\n category_id integer, -- example: [1, 2]\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_funny text, -- example: ['None', 'Low']\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 review_count text, -- example: ['Uber', 'Low', 'Medium']\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 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 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 (\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 user_review_count text, -- example: ['Medium', 'High']\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 number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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 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: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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_4 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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:\nAVG(user_yelping_since_year) where user_fans = 'uber';\nWhat is the average year needed by a user with uber fans to become an elite user?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.year_id - T1.user_yelping_since_year) AS REAL) / COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T1.user_fans = 'Uber'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(T2.year_id - T1.user_yelping_since_year) AS REAL) / COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T1.user_fans = 'Uber'", "index": 1974, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 likes integer, -- example: [0, 1]\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 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 Business (\n business_id integer, -- example: [1, 2]\n review_count text, -- example: ['Uber', 'Low', 'Medium']\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 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 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 (\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 user_review_count text, -- example: ['Medium', 'High']\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 number_of_compliments text, -- example: ['Medium', 'Low']\n PRIMARY KEY (compliment_id, user_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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 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: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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_4 text, -- example: ['None', 'Low']\n label_time_7 text, -- example: ['None', 'Low']\n label_time_9 text, -- example: ['Low', 'None']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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:\nAVG(user_yelping_since_year) where user_fans = 'uber';\nWhat is the average year needed by a user with uber fans to become an elite user?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, 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_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 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 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 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 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 tip_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_votes_cool text, -- example: ['Low', 'Uber']\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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\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_1 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_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 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: ['Mesa', '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:\nbusiness are opened for more than 8 hours refer to business_id where SUBTRACT(closing_time, opening_time) > 8; DIVIDE(COUNT(business_id where active = 'true' and city = 'Mesa' and SUBTRACT(closing_time, opening_time) > 8), COUNT(business_id where city = 'Mesa' and SUBTRACT(closing_time, opening_time) > 8)) as percentage;\nHow many business are opened for more than 8 hour in Mesa and what is the percentage of the active businesses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS ACT FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T1.active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS ACT FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'", "index": 1975, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, 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_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 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 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 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 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 tip_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_votes_cool text, -- example: ['Low', 'Uber']\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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\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_1 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_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\n label_time_15 text, -- example: ['None', 'Low']\n label_time_16 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: ['Mesa', '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:\nbusiness are opened for more than 8 hours refer to business_id where SUBTRACT(closing_time, opening_time) > 8; DIVIDE(COUNT(business_id where active = 'true' and city = 'Mesa' and SUBTRACT(closing_time, opening_time) > 8), COUNT(business_id where city = 'Mesa' and SUBTRACT(closing_time, opening_time) > 8)) as percentage;\nHow many business are opened for more than 8 hour in Mesa and what is the percentage of the active businesses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Delivery', '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 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 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 (\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 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 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_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: ['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 closing_time text, -- example: ['8PM', '9PM']\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 (\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most reviews refer to MAX(business_id) where attribute_name = 'Delivery';\nWhich user has done the most review on a business attributed to delivery?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Reviews AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'Delivery' GROUP BY T3.user_id ORDER BY COUNT(T2.business_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.user_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Reviews AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'Delivery' GROUP BY T3.user_id ORDER BY COUNT(T2.business_id) DESC LIMIT 1", "index": 1976, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['Delivery', '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 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 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 (\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 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 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_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: ['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 closing_time text, -- example: ['8PM', '9PM']\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 (\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most reviews refer to MAX(business_id) where attribute_name = 'Delivery';\nWhich user has done the most review on a business attributed to delivery?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['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 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 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: ['average', 'true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\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_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_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_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 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 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_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:\navg(user_id) where active = 'true' and SUM(SUBTRACT(closing_time, opening_time)) < 30;\nWhat is the average number of reviews written for active businesses that operate not more than 30 hours a 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 AVG(T3.user_id) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Reviews AS T3 ON T1.business_id = T3.business_id WHERE T1.active = 'true' GROUP BY T2.closing_time - T2.opening_time HAVING SUM(T2.closing_time - T2.opening_time) < 30", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT AVG(T3.user_id) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Reviews AS T3 ON T1.business_id = T3.business_id WHERE T1.active = 'true' GROUP BY T2.closing_time - T2.opening_time HAVING SUM(T2.closing_time - T2.opening_time) < 30", "index": 1977, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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: ['true', 'false']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['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 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 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: ['average', 'true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_yelping_since_year integer, -- example: [2012, 2010]\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_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_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_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 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 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_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:\navg(user_id) where active = 'true' and SUM(SUBTRACT(closing_time, opening_time)) < 30;\nWhat is the average number of reviews written for active businesses that operate not more than 30 hours a 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 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 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_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 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 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 Business (\n business_id integer, -- example: [1, 2]\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 PRIMARY KEY (attribute_id, 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 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 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: ['6PM', '8AM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '8AM', '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 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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopening hours from 8AM to 6PM refer to Business_Hours where opening_time = '8AM' and closing_time = '6PM';\nHow many business ids have opening hours from 8AM to 6PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 business_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT business_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'", "index": 1978, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 Business (\n business_id integer, -- example: [1, 2]\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 PRIMARY KEY (attribute_id, 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 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 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: ['6PM', '8AM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '8AM', '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 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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopening hours from 8AM to 6PM refer to Business_Hours where opening_time = '8AM' and closing_time = '6PM';\nHow many business ids have opening hours from 8AM to 6PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['10AM', '11AM', '12PM']\n closing_time text, -- example: ['10AM', '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 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 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_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 Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Sunday', 'Monday']\n PRIMARY KEY (day_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 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 (\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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopening hours 10AM on Saturday refer to Business_Hours where opening_time = '10AM' and day_id = 6;\nProvide business ids with opening hours 10AM on Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 business_id FROM Business_Hours WHERE day_id = 6 AND opening_time = '10AM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT business_id FROM Business_Hours WHERE day_id = 6 AND opening_time = '10AM'", "index": 1979, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['10AM', '11AM', '12PM']\n closing_time text, -- example: ['10AM', '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 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 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_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 Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Sunday', 'Monday']\n PRIMARY KEY (day_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 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 (\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 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 Years (\n year_id integer, -- example: [2005, 2006]\n actual_year 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nopening hours 10AM on Saturday refer to Business_Hours where opening_time = '10AM' and day_id = 6;\nProvide business ids with opening hours 10AM on Saturday.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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: ['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 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 PRIMARY KEY (attribute_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_review_count text, -- example: ['Medium', 'High']\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_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['6PM', '8AM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '8AM', '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_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);\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 Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (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_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 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:\nopened from 8AM to 6PM refers to Business_Hours where opening_time = '8AM' and closing_time = '6PM'; days refer to day_id;\nIndicate the business id and days which are opened from 8AM to 6PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 day_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT day_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'", "index": 1980, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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: ['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 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 PRIMARY KEY (attribute_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_review_count text, -- example: ['Medium', 'High']\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_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['6PM', '8AM', '11AM', '12PM']\n closing_time text, -- example: ['6PM', '8AM', '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_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);\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 Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (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_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 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:\nopened from 8AM to 6PM refers to Business_Hours where opening_time = '8AM' and closing_time = '6PM'; days refer to day_id;\nIndicate the business id and days which are opened from 8AM to 6PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\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 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_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_8 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_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_21 text, -- example: ['None', 'Low']\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 PRIMARY KEY (business_id)\n);\n\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 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_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\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 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_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 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 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:\ncategories of businesses refer to category_name; Sunday refers to day_of_week where day_id = 1;\nWhat are the categories of businesses that have opening time on Sunday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T4.day_of_week = 'Sunday' AND T3.opening_time <> ''", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T4.day_of_week = 'Sunday' AND T3.opening_time <> ''", "index": 1981, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\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 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_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_8 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_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_21 text, -- example: ['None', 'Low']\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 PRIMARY KEY (business_id)\n);\n\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 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_cool text, -- example: ['Low', 'Uber']\n user_review_count text, -- example: ['Medium', 'High']\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 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_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 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 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:\ncategories of businesses refer to category_name; Sunday refers to day_of_week where day_id = 1;\nWhat are the categories of businesses that have opening time on Sunday?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\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 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\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 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 review_count text, -- example: ['Low', 'Medium']\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 Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Monday', 'Sunday']\n PRIMARY KEY (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 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:\ndays from Monday to Saturday refer to day_id between 2 and 7; work the most days can be computed as MAX(COUNT(category_name where day_id between 2 and 7));\nAmong the working days from Monday to Saturday, which businesses with the category names work the most days?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.category_name FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id GROUP BY T2.category_name ORDER BY COUNT(T3.day_id) DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.category_name FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id GROUP BY T2.category_name ORDER BY COUNT(T3.day_id) DESC LIMIT 1", "index": 1982, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_4 text, -- example: ['None', 'Low']\n label_time_6 text, -- example: ['None', 'Low']\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 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 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 Users (\n user_id integer, -- example: [1, 2]\n user_review_count text, -- example: ['Medium', 'High']\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 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 review_count text, -- example: ['Low', 'Medium']\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 Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['Saturday', 'Monday', 'Sunday']\n PRIMARY KEY (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 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:\ndays from Monday to Saturday refer to day_id between 2 and 7; work the most days can be computed as MAX(COUNT(category_name where day_id between 2 and 7));\nAmong the working days from Monday to Saturday, which businesses with the category names work the most days?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 number_of_compliments text, -- example: ['Medium', 'Low']\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 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_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 (\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 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: ['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 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 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 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 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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['DJs', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of \"DJs\" refers to category_name = 'DJs'; rated less than 5 refers to stars < 5; businesses refer to business_id;\nIn businesses with a category of \"DJs\", how many businesses are rated less than 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 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 = 'DJs' AND T1.stars < 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT 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 = 'DJs' AND T1.stars < 5", "index": 1983, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 number_of_compliments text, -- example: ['Medium', 'Low']\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 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_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 (\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 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: ['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 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 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 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 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 Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['DJs', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncategory of \"DJs\" refers to category_name = 'DJs'; rated less than 5 refers to stars < 5; businesses refer to business_id;\nIn businesses with a category of \"DJs\", how many businesses are rated less than 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 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: ['8PM', '7AM', '11AM', '12PM']\n closing_time text, -- example: ['8PM', '7AM', '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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id 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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_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 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 attribute_value text, -- example: ['true', 'none', 'full_bar']\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_13 text, -- example: ['None', 'Low']\n label_time_18 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 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:\nopening times of 7AM and closing times of 8PM refer to Business_Hours where opening_time = '7AM' and closing_time = '8PM'; active business refers to business_id where active = 'true';\nList active business ids with opening times of 7AM and closing times of 8PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 T4.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Business AS T4 ON T3.business_id = T4.business_id WHERE T4.active = 'true' AND T3.opening_time = '7AM' AND T3.closing_time = '8PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT DISTINCT T4.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Business AS T4 ON T3.business_id = T4.business_id WHERE T4.active = 'true' AND T3.opening_time = '7AM' AND T3.closing_time = '8PM'", "index": 1984, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Business_Hours (\n business_id integer, -- example: [2, 3]\n day_id integer, -- example: [2, 3]\n opening_time text, -- example: ['8PM', '7AM', '11AM', '12PM']\n closing_time text, -- example: ['8PM', '7AM', '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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_id)\n);\n\nCREATE TABLE Years (\n year_id 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 PRIMARY KEY (business_id, user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n PRIMARY KEY (business_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 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 attribute_value text, -- example: ['true', 'none', 'full_bar']\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_13 text, -- example: ['None', 'Low']\n label_time_18 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 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:\nopening times of 7AM and closing times of 8PM refer to Business_Hours where opening_time = '7AM' and closing_time = '8PM'; active business refers to business_id where active = 'true';\nList active business ids with opening times of 7AM and closing times of 8PM.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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_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 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 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_1 text, -- example: ['Low', 'None']\n label_time_2 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: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_15 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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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:\nrating more than 2 refers to stars > 2;\nHow many category id have low review count and rating more than 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT COUNT(DISTINCT T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.review_count = 'Low' AND T3.stars > 2", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.review_count = 'Low' AND T3.stars > 2", "index": 1985, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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_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 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_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 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 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_1 text, -- example: ['Low', 'None']\n label_time_2 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: ['Low', 'None']\n label_time_12 text, -- example: ['Low', 'None']\n label_time_14 text, -- example: ['Low', 'None']\n label_time_15 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 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 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 Compliments (\n compliment_id integer, -- example: [1, 2]\n PRIMARY KEY (compliment_id)\n);\n\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\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:\nrating more than 2 refers to stars > 2;\nHow many category id have low review count and rating more than 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Categories (\n category_id integer, -- example: [1, 2]\n category_name text, -- example: ['Accessories', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_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_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 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 opening_time text, -- example: ['7AM', '11AM', '12PM']\n closing_time text, -- example: ['7AM', '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 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_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 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_15 text, -- example: ['None', 'Low']\n label_time_16 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 PRIMARY KEY (business_id, day_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 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);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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 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 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 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:\nopening hours before 7AM refer to opening_time < '7AM'; businesses refer to business_id;\nWhich businesses with the category name Accessories have opening hours before 7AM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id FROM Business_Hours 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 = 'Accessories' AND SUBSTR(T1.opening_time, -4, 2) * 1 < 7 AND T1.opening_time LIKE '%AM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.business_id FROM Business_Hours 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 = 'Accessories' AND SUBSTR(T1.opening_time, -4, 2) * 1 < 7 AND T1.opening_time LIKE '%AM'", "index": 1986, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Accessories', 'Active Life', 'Arts & Entertainment']\n PRIMARY KEY (category_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_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 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 opening_time text, -- example: ['7AM', '11AM', '12PM']\n closing_time text, -- example: ['7AM', '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 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_0 text, -- example: ['None', 'Low']\n label_time_1 text, -- example: ['None', 'Low']\n label_time_3 text, -- example: ['None', 'Low']\n label_time_4 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_15 text, -- example: ['None', 'Low']\n label_time_16 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 PRIMARY KEY (business_id, day_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 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);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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 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 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 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:\nopening hours before 7AM refer to opening_time < '7AM'; businesses refer to business_id;\nWhich businesses with the category name Accessories have opening hours before 7AM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 state text, -- example: ['AZ', 'SC']\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 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 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: ['12PM', '11AM']\n closing_time text, -- example: ['12PM', '8PM', '9PM']\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 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_4 text, -- example: ['None', 'Low']\n label_time_5 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_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\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 Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 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 attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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 (\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 user_votes_cool text, -- example: ['Low', 'Uber']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses in Arizona refer to business_id where state = 'Arizona' and active = 'true'; work after 12PM refer to opening_time > '12PM';\nAmong the active businesses in Arizona, how many businesses work after 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_Hours AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T1.opening_time > '12PM'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT COUNT(DISTINCT T2.business_id) FROM Business_Hours AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T1.opening_time > '12PM'", "index": 1987, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 state text, -- example: ['AZ', 'SC']\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 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 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: ['12PM', '11AM']\n closing_time text, -- example: ['12PM', '8PM', '9PM']\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 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_4 text, -- example: ['None', 'Low']\n label_time_5 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_15 text, -- example: ['None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\n label_time_18 text, -- example: ['None', 'Low']\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 Reviews (\n business_id integer, -- example: [1, 2]\n user_id integer, -- example: [36129, 40299]\n review_stars integer, -- example: [2, 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 attribute_value text, -- example: ['true', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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 (\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 user_votes_cool text, -- example: ['Low', 'Uber']\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive businesses in Arizona refer to business_id where state = 'Arizona' and active = 'true'; work after 12PM refer to opening_time > '12PM';\nAmong the active businesses in Arizona, how many businesses work after 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 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 PRIMARY KEY (business_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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_16 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_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_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (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);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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_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 Years (\n year_id 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 opening_time text, -- example: ['8PM', '7AM', '11AM', '12PM']\n closing_time text, -- example: ['8PM', '7AM', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(business_id where category_name = 'Food' and opening_time = '7AM' and closing_time = '8PM'), COUNT(business_id where opening_time = '7AM' and closing_time = '8PM')) as percentage;\nCalculate the percentage of businesses with the category name food that are open from 7AM to 8PM in the businesses with the same time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT CAST(SUM(CASE WHEN T3.category_name = 'Food' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(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", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT CAST(SUM(CASE WHEN T3.category_name = 'Food' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(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", "index": 1988, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 PRIMARY KEY (business_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 Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\n label_time_16 text, -- example: ['None', 'Low']\n PRIMARY KEY (business_id, day_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_fans text, -- example: ['Low', 'None']\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n state text, -- example: ['AZ', 'SC']\n PRIMARY KEY (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);\n\nCREATE TABLE Attributes (\n attribute_id integer, -- example: [1, 2]\n PRIMARY KEY (attribute_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_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 Years (\n year_id 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 opening_time text, -- example: ['8PM', '7AM', '11AM', '12PM']\n closing_time text, -- example: ['8PM', '7AM', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nDIVIDE(COUNT(business_id where category_name = 'Food' and opening_time = '7AM' and closing_time = '8PM'), COUNT(business_id where opening_time = '7AM' and closing_time = '8PM')) as percentage;\nCalculate the percentage of businesses with the category name food that are open from 7AM to 8PM in the businesses with the same time.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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: ['list', 'photos', 'cool']\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 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 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_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 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 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);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\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_13 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_20 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear_id = '2006';\nList any five of user ID who became elite user in 2006.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT user_id FROM Elite WHERE year_id = 2006 LIMIT 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT user_id FROM Elite WHERE year_id = 2006 LIMIT 5", "index": 1989, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\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 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: ['list', 'photos', 'cool']\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 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 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_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 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 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);\n\nCREATE TABLE Checkins (\n business_id integer, -- example: [1, 2]\n day_id integer, -- example: [1, 2]\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_13 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_20 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 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 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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nyear_id = '2006';\nList any five of user ID who became elite user in 2006.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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_8 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_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 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 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_average_stars text, -- example: ['4.0', '2.5']\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 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 Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\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:\ncategory that starts with alphabet \"P\" refers to category_name like 'P%';\nWrite down the any five of ID and name of category that starts with alphabet \"P\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT category_id, category_name FROM Categories WHERE category_name LIKE 'P%' LIMIT 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT category_id, category_name FROM Categories WHERE category_name LIKE 'P%' LIMIT 5", "index": 1990, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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_8 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_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 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 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_average_stars text, -- example: ['4.0', '2.5']\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 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 Business (\n business_id integer, -- example: [1, 2]\n city text, -- example: ['Phoenix', 'Scottsdale']\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:\ncategory that starts with alphabet \"P\" refers to category_name like 'P%';\nWrite down the any five of ID and name of category that starts with alphabet \"P\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\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 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 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 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_2 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: ['Medium', 'None', 'Low']\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_16 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\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 PRIMARY KEY (attribute_id, 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 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 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 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 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 (\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 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_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_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:\n;\nProvide the list of user ID along with review star of which has the review length of medium with business ID of 35.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT user_id, review_stars FROM Reviews WHERE business_id = 15 AND review_length = 'Medium'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT user_id, review_stars FROM Reviews WHERE business_id = 15 AND review_length = 'Medium'", "index": 1991, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_stars integer, -- example: [2, 1]\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 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 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 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_2 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: ['Medium', 'None', 'Low']\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_16 text, -- example: ['Medium', 'None', 'Low']\n label_time_17 text, -- example: ['Low', 'None']\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 PRIMARY KEY (attribute_id, 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 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 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 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 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 (\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 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_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_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:\n;\nProvide the list of user ID along with review star of which has the review length of medium with business ID of 35.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (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 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 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: ['list', '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_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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['payment_types_visa', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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_9 text, -- example: ['Low', 'None']\n label_time_14 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_votes_useful text, -- example: ['None', 'Low']\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:\nList down the business ID and attribute value of the attribute name of \"payment_types_visa\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.business_id, T2.attribute_value FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'payment_types_visa'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.business_id, T2.attribute_value FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'payment_types_visa'", "index": 1992, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (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 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 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: ['list', '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_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 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 Attributes (\n attribute_id integer, -- example: [1, 2]\n attribute_name text, -- example: ['payment_types_visa', 'Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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_9 text, -- example: ['Low', 'None']\n label_time_14 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_votes_useful text, -- example: ['None', 'Low']\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:\nList down the business ID and attribute value of the attribute name of \"payment_types_visa\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 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 compliment_type text, -- example: ['profile', 'list', 'photos', 'cool']\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 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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\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_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 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: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Uber', '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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen join Yelp refers to user_yelping_since_year; compliment_type = 'profile'; number_of_compliments = 'Uber';\nAmong the user ID with number in compliment of uber on profile, list any 5 user ID and the year when they join Yelp.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id, T3.user_yelping_since_year FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.compliment_type = 'profile' AND T2.number_of_compliments = 'Uber' LIMIT 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T3.user_id, T3.user_yelping_since_year FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.compliment_type = 'profile' AND T2.number_of_compliments = 'Uber' LIMIT 5", "index": 1993, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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 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 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 compliment_type text, -- example: ['profile', 'list', 'photos', 'cool']\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 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 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 opening_time text, -- example: ['11AM', '12PM']\n closing_time text, -- example: ['8PM', '9PM']\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_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 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: ['Uber', 'None', 'Low']\n label_time_11 text, -- example: ['Uber', 'Low', 'None']\n label_time_12 text, -- example: ['Uber', 'None', 'Low']\n label_time_13 text, -- example: ['Uber', 'None', 'Low']\n label_time_14 text, -- example: ['Uber', 'None', 'Low']\n label_time_15 text, -- example: ['Uber', 'None', 'Low']\n label_time_16 text, -- example: ['Uber', 'None', 'Low']\n label_time_17 text, -- example: ['Uber', 'Low', 'None']\n label_time_18 text, -- example: ['Uber', '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: ['Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n stars real, -- example: [3.0, 4.5]\n review_count text, -- example: ['Uber', '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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen join Yelp refers to user_yelping_since_year; compliment_type = 'profile'; number_of_compliments = 'Uber';\nAmong the user ID with number in compliment of uber on profile, list any 5 user ID and the year when they join Yelp.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_votes_cool text, -- example: ['Low', 'Uber']\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 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 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 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_3 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_19 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 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 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 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 (\n business_id integer, -- example: [1, 2]\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness which received the most likes refers to business_id where MAX(likes);\nList the user ID, business ID with review length of the business which received the most likes in tips.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_id, T1.business_id, T2.review_length FROM Tips AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ORDER BY T1.likes DESC LIMIT 1", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T1.user_id, T1.business_id, T2.review_length FROM Tips AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ORDER BY T1.likes DESC LIMIT 1", "index": 1994, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_votes_cool text, -- example: ['Low', 'Uber']\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 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 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 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_3 text, -- example: ['None', 'Low']\n label_time_10 text, -- example: ['None', 'Low']\n label_time_19 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 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 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 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 (\n business_id integer, -- example: [1, 2]\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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness which received the most likes refers to business_id where MAX(likes);\nList the user ID, business ID with review length of the business which received the most likes in tips.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Black Canyon City', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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_cool text, -- example: ['None', 'Low']\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);\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 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 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 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 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_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_14 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: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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 (\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrunning refers to active = 'true'; opening day of a week means days of the week when business is open;\nWrite down the ID and opening day of a week for the business which are running in Black Canyon City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.business_id, T3.day_of_week 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 = 'Black Canyon City' AND T1.active = 'true'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.business_id, T3.day_of_week 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 = 'Black Canyon City' AND T1.active = 'true'", "index": 1995, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Black Canyon City', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\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_cool text, -- example: ['None', 'Low']\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);\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 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 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 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 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_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_14 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: ['Alcohol', 'Waiter Service']\n PRIMARY KEY (attribute_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 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 (\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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrunning refers to active = 'true'; opening day of a week means days of the week when business is open;\nWrite down the ID and opening day of a week for the business which are running in Black Canyon City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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: ['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 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 review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_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 likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\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_1 text, -- example: ['None', 'Low']\n label_time_2 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_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_23 text, -- example: ['None', 'Low']\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_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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser who joined Yelp in 2004 refers to user_id where user_yelping_since_year = 2014; user_average_stars = 5;\nWithin the user who joined Yelp in 2004, explore the user ID with average star of 5 and it's review length on the business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT T2.user_id, T2.review_length FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_average_stars = 5", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT T2.user_id, T2.review_length FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_average_stars = 5", "index": 1996, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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: ['average', 'none', 'full_bar']\n PRIMARY KEY (attribute_id, business_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 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: ['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 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 review_count text, -- example: ['Low', 'Medium']\n PRIMARY KEY (business_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 likes integer, -- example: [0, 1]\n tip_length text, -- example: ['Medium', 'Short']\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_1 text, -- example: ['None', 'Low']\n label_time_2 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_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_23 text, -- example: ['None', 'Low']\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_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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nuser who joined Yelp in 2004 refers to user_id where user_yelping_since_year = 2014; user_average_stars = 5;\nWithin the user who joined Yelp in 2004, explore the user ID with average star of 5 and it's review length on the business.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_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);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Mesa', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\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 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_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 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_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\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 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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrunning business refers to business where active = 'true';\nCalculate the difference between running business in Glendale City and Mesa City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "role": "user" } ]
nl2sql
{ "ground_truth": "SELECT SUM(CASE WHEN city = 'Glendale' THEN 1 ELSE 0 END) - SUM(CASE WHEN city = 'Mesa' THEN 1 ELSE 0 END) AS diff FROM Business WHERE active = 'true'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT SUM(CASE WHEN city = 'Glendale' THEN 1 ELSE 0 END) - SUM(CASE WHEN city = 'Mesa' THEN 1 ELSE 0 END) AS diff FROM Business WHERE active = 'true'", "index": 1997, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 PRIMARY KEY (day_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);\n\nCREATE TABLE Users (\n user_id integer, -- example: [1, 2]\n PRIMARY KEY (user_id)\n);\n\nCREATE TABLE Business (\n business_id integer, -- example: [1, 2]\n active text, -- example: ['true', 'false']\n city text, -- example: ['Glendale', 'Mesa', 'Phoenix', 'Scottsdale']\n state text, -- example: ['AZ', 'SC']\n review_count text, -- example: ['Low', 'Medium']\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 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_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 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_10 text, -- example: ['None', 'Low']\n label_time_12 text, -- example: ['None', 'Low']\n label_time_13 text, -- example: ['None', 'Low']\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 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 Categories (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_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 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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrunning business refers to business where active = 'true';\nCalculate the difference between running business in Glendale City and Mesa City.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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_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 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 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 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 Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_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 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_7 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: ['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_23 text, -- example: ['None', 'Low']\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 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 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: ['Short', 'Medium']\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:\nshort comment refers to tip_length = 'Short'; users who joined in 2010 refer to user_id where user_yelping_since_year = 2010;\nHow many likes did short comment left by users who joined in 2010 get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.likes) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2010", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT SUM(T2.likes) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2010", "index": 1998, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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_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 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 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 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 Days (\n day_id integer, -- example: [1, 2]\n PRIMARY KEY (day_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 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_7 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: ['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_23 text, -- example: ['None', 'Low']\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 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 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: ['Short', 'Medium']\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:\nshort comment refers to tip_length = 'Short'; users who joined in 2010 refer to user_id where user_yelping_since_year = 2010;\nHow many likes did short comment left by users who joined in 2010 get?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }
nl2sql
[ { "content": "You are a helpful assistant.", "role": "system" }, { "content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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 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 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 actual_year 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 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 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 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: ['Short', 'Medium']\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_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_10 text, -- example: ['None', 'Low']\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 label_time_19 text, -- example: ['None', 'Low']\n label_time_20 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 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 Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['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:\nshort reviews refer to tip_length = 'Short';\nSum up the likes get by short reviews on businesses located in City Goodyear.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.likes) AS likes FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Goodyear'", "style": "rule" }
{ "db_id": "public_review_platform.sqlite", "gt_sql": "SELECT SUM(T2.likes) AS likes FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Goodyear'", "index": 1999, "question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_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_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 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 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 actual_year 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 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 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 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: ['Short', 'Medium']\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_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_10 text, -- example: ['None', 'Low']\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 label_time_19 text, -- example: ['None', 'Low']\n label_time_20 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 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 Days (\n day_id integer, -- example: [1, 2]\n day_of_week text, -- example: ['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:\nshort reviews refer to tip_length = 'Short';\nSum up the likes get by short reviews on businesses located in City Goodyear.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n", "split": "train" }