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 ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'When', 'Max', 'In the Name Of', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_followers integer, -- example: [5, 1]\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nlongest movie title refers to MAX(LENGTH(movie_title)); when it was released refers to movie_release_year;\nWhat is the name of the longest movie title? When was it released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_title, movie_release_year FROM movies ORDER BY LENGTH(movie_popularity) DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_title, movie_release_year FROM movies ORDER BY LENGTH(movie_popularity) DESC LIMIT 1",
"index": 0,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'When', 'Max', 'In the Name Of', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_followers integer, -- example: [5, 1]\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nlongest movie title refers to MAX(LENGTH(movie_title)); when it was released refers to movie_release_year;\nWhat is the name of the longest movie title? When was it released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Avatar', 'Her', 'Him', 'Avatar 3', 'Avatar 2', 'La Antena']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Latest', 'Rated', 'Rate', 'rate', 'her']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 avatar url refers to user_avatar_image_url; latest movie rated refers to latest rating_date;\nWhat is the user avatar url for user 41579158? What is the latest movie rated by him / her?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_avatar_image_url, T3.rating_date_utc FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id INNER JOIN ratings_users AS T3 ON T3.user_id = T2.user_id WHERE T3.user_id = 41579158 ORDER BY T3.rating_date_utc DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T3.user_avatar_image_url, T3.rating_date_utc FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id INNER JOIN ratings_users AS T3 ON T3.user_id = T2.user_id WHERE T3.user_id = 41579158 ORDER BY T3.rating_date_utc DESC LIMIT 1",
"index": 1,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Avatar', 'Her', 'Him', 'Avatar 3', 'Avatar 2', 'La Antena']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Latest', 'Rated', 'Rate', 'rate', 'her']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 avatar url refers to user_avatar_image_url; latest movie rated refers to latest rating_date;\nWhat is the user avatar url for user 41579158? What is the latest movie rated by him / her?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Percentage', 'Divide', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n PRIMARY KEY (movie_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 is a subscriber refers to user_subscriber = 1; percentage of ratings = DIVIDE(SUM(user_subscriber = 1), SUM(rating_score)) as percent;\nWhat is the percentage of the ratings were rated by user who was a subcriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings",
"index": 2,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Percentage', 'Divide', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n PRIMARY KEY (movie_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 is a subscriber refers to user_subscriber = 1; percentage of ratings = DIVIDE(SUM(user_subscriber = 1), SUM(rating_score)) as percent;\nWhat is the percentage of the ratings were rated by user who was a subcriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Score', 'Rated', 'Rate', 'rate', 'no rating']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nratings in year 2020 refers to rating_timestamp_utc like '%2020%'; rating_score > = 4;\nFor all ratings which are rated in year 2020, name the movies which has the rating scored 4 and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE CAST(SUBSTR(T1.rating_timestamp_utc, 1, 4) AS INTEGER) = 2020 AND CAST(SUBSTR(T1.rating_timestamp_utc, 6, 2) AS INTEGER) > 4",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE CAST(SUBSTR(T1.rating_timestamp_utc, 1, 4) AS INTEGER) = 2020 AND CAST(SUBSTR(T1.rating_timestamp_utc, 6, 2) AS INTEGER) > 4",
"index": 3,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Score', 'Rated', 'Rate', 'rate', 'no rating']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nratings in year 2020 refers to rating_timestamp_utc like '%2020%'; rating_score > = 4;\nFor all ratings which are rated in year 2020, name the movies which has the rating scored 4 and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['director', 'Title', 'title', 'sex', 'Directors', 'DIRECTORS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Sex, Drink and Bloodshed', 'The Director', 'Bloodshed', 'Director', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nSex, Drink and Bloodshed refers to movie title = 'Sex, Drink and Bloodshed';\nWho is the director of the movie Sex, Drink and Bloodshed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT director_name FROM movies WHERE movie_title = 'Sex, Drink and Bloodshed'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT director_name FROM movies WHERE movie_title = 'Sex, Drink and Bloodshed'",
"index": 4,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['director', 'Title', 'title', 'sex', 'Directors', 'DIRECTORS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Sex, Drink and Bloodshed', 'The Director', 'Bloodshed', 'Director', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nSex, Drink and Bloodshed refers to movie title = 'Sex, Drink and Bloodshed';\nWho is the director of the movie Sex, Drink and Bloodshed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Followed', 'Follower', 'Follow', 'Most', 'Max', 'In the Name Of']\n movie_title_language text, -- example: ['en']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'Max', 'Films that made your kid sister cry', 'Headscratchers']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmost followed list refers to MAX(list_followers);\nWhat is the name of the most followed list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT list_title FROM lists ORDER BY list_followers DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT list_title FROM lists ORDER BY list_followers DESC LIMIT 1",
"index": 5,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Followed', 'Follower', 'Follow', 'Most', 'Max', 'In the Name Of']\n movie_title_language text, -- example: ['en']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'Max', 'Films that made your kid sister cry', 'Headscratchers']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmost followed list refers to MAX(list_followers);\nWhat is the name of the most followed list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nfirst created list refers to oldest list_creation_date_utc;\nWhat is the list ID that was first created by user 85981819?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT list_id FROM lists_users WHERE user_id = 85981819 ORDER BY list_creation_date_utc ASC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT list_id FROM lists_users WHERE user_id = 85981819 ORDER BY list_creation_date_utc ASC LIMIT 1",
"index": 6,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nfirst created list refers to oldest list_creation_date_utc;\nWhat is the list ID that was first created by user 85981819?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Score', 'Rated', 'Rate', 'rate', 'Films that made your kid sister cry']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'how', 'less than 1', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'Users', 'Trial', 'Less', 'When', 'ID']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npaying subscriber refers to user_has_payment_method = 1; eligible for trial refers to user_eligible_for_trial = 1; rating_score< = 2;\nFor movie id 1269, how many users, who was a paying subscriber and was eligible for trial when he rated the movie, gave the movie a rating score of less than or equal to 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(*) FROM ratings WHERE movie_id = 1269 AND rating_score <= 2 AND user_eligible_for_trial = 1 AND user_has_payment_method = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ratings WHERE movie_id = 1269 AND rating_score <= 2 AND user_eligible_for_trial = 1 AND user_has_payment_method = 1",
"index": 7,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Score', 'Rated', 'Rate', 'rate', 'Films that made your kid sister cry']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'how', 'less than 1', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'Users', 'Trial', 'Less', 'When', 'ID']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npaying subscriber refers to user_has_payment_method = 1; eligible for trial refers to user_eligible_for_trial = 1; rating_score< = 2;\nFor movie id 1269, how many users, who was a paying subscriber and was eligible for trial when he rated the movie, gave the movie a rating score of less than or equal to 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 ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Spielberg', 'Popular', 'Release', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Steven Spielberg', 'Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie released in 2021 refers to movie_release_year = 2021; popularity refers to movie_popularity;\nWhat are the movie popularity of the movies released in 2021 that were directed by Steven Spielberg? List the names of the movies and their corresponding popularity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_title, movie_popularity FROM movies WHERE movie_release_year = 2021 AND director_name = 'Steven Spielberg'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_title, movie_popularity FROM movies WHERE movie_release_year = 2021 AND director_name = 'Steven Spielberg'",
"index": 8,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Spielberg', 'Popular', 'Release', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Steven Spielberg', 'Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie released in 2021 refers to movie_release_year = 2021; popularity refers to movie_popularity;\nWhat are the movie popularity of the movies released in 2021 that were directed by Steven Spielberg? List the names of the movies and their corresponding popularity.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst movie refers to oldest movie_release_year;\nWhen was the first movie released and who directed it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_release_year, director_name FROM movies WHERE movie_release_year IS NOT NULL ORDER BY movie_release_year ASC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_release_year, director_name FROM movies WHERE movie_release_year IS NOT NULL ORDER BY movie_release_year ASC LIMIT 1",
"index": 9,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfirst movie refers to oldest movie_release_year;\nWhen was the first movie released and who directed it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Traveller', 'rating', 'Score', 'Travel.', 'Travels', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Pavee Lackeen: The Traveller Girl', 'Score', 'Users', 'Travellers', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'False', 'how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nFALSE;\nHow many users gave \"Pavee Lackeen: The Traveller Girl\" movie a rating score of 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'Pavee Lackeen: The Traveller Girl' AND T2.rating_score = 4",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'Pavee Lackeen: The Traveller Girl' AND T2.rating_score = 4",
"index": 10,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Traveller', 'rating', 'Score', 'Travel.', 'Travels', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Pavee Lackeen: The Traveller Girl', 'Score', 'Users', 'Travellers', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'False', 'how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nFALSE;\nHow many users gave \"Pavee Lackeen: The Traveller Girl\" movie a rating score of 4?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['QueNtin tarantino', 'QUENTIN TARANTINO', 'Quentin Tarantino', 'Quentin TARANTINO', 'quentin tarantino', 'Quentin tarantino']\n list_movie_number integer, -- example: [5, 3]\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'Score', 'ID', 'Id', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Quentin Tarantino', 'Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthird movie refers to third movie that has oldest movie_release_year;\nWhich year was the third movie directed by Quentin Tarantino released? Indicate the user ids of the user who gave it a rating score of 4.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_release_year, T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_id = ( SELECT movie_id FROM movies WHERE director_name = 'Quentin Tarantino' ORDER BY movie_release_year ASC LIMIT 2, 1 ) AND T1.rating_score = 4",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_release_year, T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_id = ( SELECT movie_id FROM movies WHERE director_name = 'Quentin Tarantino' ORDER BY movie_release_year ASC LIMIT 2, 1 ) AND T1.rating_score = 4",
"index": 11,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['QueNtin tarantino', 'QUENTIN TARANTINO', 'Quentin Tarantino', 'Quentin TARANTINO', 'quentin tarantino', 'Quentin tarantino']\n list_movie_number integer, -- example: [5, 3]\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'Score', 'ID', 'Id', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Quentin Tarantino', 'Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthird movie refers to third movie that has oldest movie_release_year;\nWhich year was the third movie directed by Quentin Tarantino released? Indicate the user ids of the user who gave it a rating score of 4.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['francis ford coppola', 'Francis Ford Coppola', 'ford coppola', 'Directed By', 'Popular', 'COppola']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Francis Ford Coppola', 'Francis Ford', 'Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrancis Ford Coppola refers to director_name; popularity of more than 1,000 refers to movie_popularity >1000;highest amount of likes that each critic per movie has received refers to MAX(critic_likes)\nHow many movies directed by Francis Ford Coppola have a popularity of more than 1,000? Indicate what is the highest amount of likes that each critic per movie has received, if there's any.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title), T1.critic FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Francis Ford Coppola' AND T2.movie_popularity > 1000",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.movie_title), T1.critic FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Francis Ford Coppola' AND T2.movie_popularity > 1000",
"index": 12,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['francis ford coppola', 'Francis Ford Coppola', 'ford coppola', 'Directed By', 'Popular', 'COppola']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Francis Ford Coppola', 'Francis Ford', 'Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFrancis Ford Coppola refers to director_name; popularity of more than 1,000 refers to movie_popularity >1000;highest amount of likes that each critic per movie has received refers to MAX(critic_likes)\nHow many movies directed by Francis Ford Coppola have a popularity of more than 1,000? Indicate what is the highest amount of likes that each critic per movie has received, if there's any.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Profile', 'Score', 'Image', 'ID', 'Id', 'Profiler']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Score', 'Mubi ', 'IMAGE', '4/19', 'MUBI', 'Mubi']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nURL to the user profile image on Mubi refers to user_avatar_image_url; 4/19/2020 refers to rating_date_utc\nWhat is the URL to the user profile image on Mubi of the user who gave the movie id of 1103 a 5 ratinng score on 4/19/2020?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_avatar_image_url FROM ratings AS T1 INNER JOIN ratings_users AS T2 ON T1.user_id = T2.user_id WHERE T2.user_id = 1103 AND rating_score = 5 AND T2.rating_date_utc = '2020-04-19'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.user_avatar_image_url FROM ratings AS T1 INNER JOIN ratings_users AS T2 ON T1.user_id = T2.user_id WHERE T2.user_id = 1103 AND rating_score = 5 AND T2.rating_date_utc = '2020-04-19'",
"index": 13,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Profile', 'Score', 'Image', 'ID', 'Id', 'Profiler']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Score', 'Mubi ', 'IMAGE', '4/19', 'MUBI', 'Mubi']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nURL to the user profile image on Mubi refers to user_avatar_image_url; 4/19/2020 refers to rating_date_utc\nWhat is the URL to the user profile image on Mubi of the user who gave the movie id of 1103 a 5 ratinng score on 4/19/2020?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['Mean', 'how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Max', 'number 1', 'Number 2', 'Numbers', 'Films that made your kid sister cry']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Replace', 'Follow', 'When', 'Max', 'Followed']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_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 4208563 refers to user_id;highest number of followers refers to MAX(list_followers); user_subscriber = 1 means that the user was a subscriber when he created the list; user_subscriber = 0 means the user was not a subscriber when he created the list (to replace)\nAmong the lists created by user 4208563, which one has the highest number of followers? Indicate how many followers it has and whether the user was a subscriber or not when he created the list.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.list_followers, T2.user_subscriber = 1 FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id AND T2.list_id = T2.list_id WHERE T2.user_id = 4208563 ORDER BY T1.list_followers DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.list_followers, T2.user_subscriber = 1 FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id AND T2.list_id = T2.list_id WHERE T2.user_id = 4208563 ORDER BY T1.list_followers DESC LIMIT 1",
"index": 14,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['Mean', 'how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Max', 'number 1', 'Number 2', 'Numbers', 'Films that made your kid sister cry']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Replace', 'Follow', 'When', 'Max', 'Followed']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_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 4208563 refers to user_id;highest number of followers refers to MAX(list_followers); user_subscriber = 1 means that the user was a subscriber when he created the list; user_subscriber = 0 means the user was not a subscriber when he created the list (to replace)\nAmong the lists created by user 4208563, which one has the highest number of followers? Indicate how many followers it has and whether the user was a subscriber or not when he created the list.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Title', 'Release', 'Score', 'Max', 'A Number', 'Numbers']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nleast number of movies refers to MIN(movie_release_year); highest rating score refers to MAX(SUM(movie_id) where rating_score = '1')\n\n\nWhich year has the least number of movies that was released and what is the title of the movie in that year that has the highest number of rating score of 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 DISTINCT T1.movie_release_year, T1.movie_title FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_release_year = ( SELECT movie_release_year FROM movies GROUP BY movie_release_year ORDER BY COUNT(movie_id) DESC LIMIT 1 ) AND T2.rating_score = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT DISTINCT T1.movie_release_year, T1.movie_title FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_release_year = ( SELECT movie_release_year FROM movies GROUP BY movie_release_year ORDER BY COUNT(movie_id) DESC LIMIT 1 ) AND T2.rating_score = 1",
"index": 15,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Title', 'Release', 'Score', 'Max', 'A Number', 'Numbers']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nleast number of movies refers to MIN(movie_release_year); highest rating score refers to MAX(SUM(movie_id) where rating_score = '1')\n\n\nWhich year has the least number of movies that was released and what is the title of the movie in that year that has the highest number of rating score of 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 ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Riff-Raff', 'Score', 'Given', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nURL refer to rating_url; user 22030372 refer to user_id\nWhat is the URL to the rating on Mubi of the Riff-Raff movie that was given the highest rating score by user 22030372?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.rating_url FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_id = 22030372 AND T2.rating_score = 5 AND T1.movie_title = 'Riff-Raff'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.rating_url FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_id = 22030372 AND T2.rating_score = 5 AND T1.movie_title = 'Riff-Raff'",
"index": 16,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Riff-Raff', 'Score', 'Given', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nURL refer to rating_url; user 22030372 refer to user_id\nWhat is the URL to the rating on Mubi of the Riff-Raff movie that was given the highest rating score by user 22030372?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Average', 'The Crowd', 'Director', 'Score', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['director', 'average', 'rating', 'Score', 'Directors', 'DIRECTORS']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['average', 'AVERAGE', 'score', 'average.', 'Average.', 'I am a bit disappointed by this document']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ndirector refer to director_name; The Crowd refer to movie_title; Average refer to AVG(rating_score)\nWhat is the average rating score of the movie \"The Crowd\" and who was its director?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T2.rating_score), T1.director_name FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'The Crowd'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT AVG(T2.rating_score), T1.director_name FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T1.movie_title = 'The Crowd'",
"index": 17,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Average', 'The Crowd', 'Director', 'Score', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['director', 'average', 'rating', 'Score', 'Directors', 'DIRECTORS']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['average', 'AVERAGE', 'score', 'average.', 'Average.', 'I am a bit disappointed by this document']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ndirector refer to director_name; The Crowd refer to movie_title; Average refer to AVG(rating_score)\nWhat is the average rating score of the movie \"The Crowd\" and who was its director?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Average', 'Popular', 'Score', 'Him', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Christopher Nolan', 'Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\n5 rating scores refer to rating_score; Christopher Nolan refer to director_name; average popularity of each movie refer to AVG(movie_popularity where director_name = 'Christopher Nolan')\nWhat is the average popularity of each movie that was directed by Christopher Nolan? Indicate which movie directed by him has received the highest number of 5 rating scores.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T2.movie_popularity) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Christopher Nolan'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT AVG(T2.movie_popularity) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Christopher Nolan'",
"index": 18,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Average', 'Popular', 'Score', 'Him', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Christopher Nolan', 'Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\n5 rating scores refer to rating_score; Christopher Nolan refer to director_name; average popularity of each movie refer to AVG(movie_popularity where director_name = 'Christopher Nolan')\nWhat is the average popularity of each movie that was directed by Christopher Nolan? Indicate which movie directed by him has received the highest number of 5 rating scores.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['The Movie List', 'movie list', 'Movie List', 'create', 'have', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'After', 'Them', '1/1', 'Followed']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ncreated after 2010/1/1 refers to list_update_timestamp_utc>'2010/1/1'; over 200 followers refers to list_followers>200;\nAmong the movie lists created after 2010/1/1, how many of them have over 200 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 COUNT(*) FROM lists WHERE list_followers > 200 AND list_update_timestamp_utc > '2010-01-01'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(*) FROM lists WHERE list_followers > 200 AND list_update_timestamp_utc > '2010-01-01'",
"index": 19,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['The Movie List', 'movie list', 'Movie List', 'create', 'have', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'After', 'Them', '1/1', 'Followed']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ncreated after 2010/1/1 refers to list_update_timestamp_utc>'2010/1/1'; over 200 followers refers to list_followers>200;\nAmong the movie lists created after 2010/1/1, how many of them have over 200 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 movies (\n movie_id integer, -- example: [1, 2]\n movie_title_language text, -- example: ['en']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['movie list', 'Movie List', 'create', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was a subscriber when he created the list refers to user_subscriber = 1; user 83373278 refers to user_id = 83373278;\nHow many movie lists were created by user 83373278 when he or she was a subscriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 lists_users WHERE user_id = 83373278 AND user_subscriber = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(*) FROM lists_users WHERE user_id = 83373278 AND user_subscriber = 1",
"index": 20,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title_language text, -- example: ['en']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['movie list', 'Movie List', 'create', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was a subscriber when he created the list refers to user_subscriber = 1; user 83373278 refers to user_id = 83373278;\nHow many movie lists were created by user 83373278 when he or she was a subscriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Please Give', 'La Antena', 'Give', 'Please!', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmovie La Antena refers to movie_title = 'La Antena'; url refers to movie_url;\nPlease give me the url of the movie \"La Antena\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_url FROM movies WHERE movie_title = 'La Antena'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_url FROM movies WHERE movie_title = 'La Antena'",
"index": 21,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Please Give', 'La Antena', 'Give', 'Please!', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmovie La Antena refers to movie_title = 'La Antena'; url refers to movie_url;\nPlease give me the url of the movie \"La Antena\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The General', 'Il grido', 'Popular', 'Higher', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_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 General and Il grido are movie_title; more popular movie refers to higher (movie_popularity);\nWhich movie is more popular, \"The General\" or \"Il grido\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_title FROM movies WHERE movie_title = 'The General' OR movie_title = 'Il grido' ORDER BY movie_popularity DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_title FROM movies WHERE movie_title = 'The General' OR movie_title = 'Il grido' ORDER BY movie_popularity DESC LIMIT 1",
"index": 22,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The General', 'Il grido', 'Popular', 'Higher', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_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 General and Il grido are movie_title; more popular movie refers to higher (movie_popularity);\nWhich movie is more popular, \"The General\" or \"Il grido\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite Films ', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was a trialist when he created the list refers to user_trailist = 1; 250 Favourite Films is list_title;\nWas the user who created the list \"250 Favourite Films\" a trialist when he or she created the list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.user_trialist FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.list_title = '250 Favourite Films'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.user_trialist FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.list_title = '250 Favourite Films'",
"index": 23,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite Films ', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was a trialist when he created the list refers to user_trailist = 1; 250 Favourite Films is list_title;\nWas the user who created the list \"250 Favourite Films\" a trialist when he or she created the list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['The Movie List', 'movie list', 'Movie List', 'please', 'create', 'Title']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was eligible for trail when he created the list refers to user_eligile_for_trail = 1; user 32172230 refers to user_id = 32172230;\nPlease list the titles of the movie lists user 32172230 created when he or she was eligible for trial.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.list_title FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.user_id = 32172230 AND T2.user_eligible_for_trial = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.list_title FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.user_id = 32172230 AND T2.user_eligible_for_trial = 1",
"index": 24,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['The Movie List', 'movie list', 'Movie List', 'please', 'create', 'Title']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was eligible for trail when he created the list refers to user_eligile_for_trail = 1; user 32172230 refers to user_id = 32172230;\nPlease list the titles of the movie lists user 32172230 created when he or she was eligible for trial.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['When', 'La Antena', 'Elementary Particles']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was a paying subscriber when he created the list refers to user_has_payment_method = 1; movie lists with over 100 refers to list_movie_number >100; user 85981819 refers to user_id = 85981819;\nHow many movie lists with over 100 movies had user 85981819 created when he or she was a paying subscriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.user_id = 85981819 AND T1.list_movie_number > 100 AND T2.user_has_payment_method = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(*) FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.user_id = 85981819 AND T1.list_movie_number > 100 AND T2.user_has_payment_method = 1",
"index": 25,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['When', 'La Antena', 'Elementary Particles']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe user was a paying subscriber when he created the list refers to user_has_payment_method = 1; movie lists with over 100 refers to list_movie_number >100; user 85981819 refers to user_id = 85981819;\nHow many movie lists with over 100 movies had user 85981819 created when he or she was a paying subscriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'Most', 'Max', 'Followed', 'La Antena']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['movie list', 'Movie List', 'the most', 'The most', 'Max', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 85981819 refers to user_id = 85981819; most followers refers to Max(list_followers); description refers to list_descriptions;\nWhat's the description of user 85981819's movie list with the most 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.list_description FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.user_id = 85981819 ORDER BY T1.list_followers DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.list_description FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.user_id = 85981819 ORDER BY T1.list_followers DESC LIMIT 1",
"index": 26,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'Most', 'Max', 'Followed', 'La Antena']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['movie list', 'Movie List', 'the most', 'The most', 'Max', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 85981819 refers to user_id = 85981819; most followers refers to Max(list_followers); description refers to list_descriptions;\nWhat's the description of user 85981819's movie list with the most 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 movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Avatar', 'Image', 'Avatar 3', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite Films ', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n250 Favourite Films refers to list_title; avatar image refers to user_avatar_image_url;\nWhat's the avatar image of the user who created the movie list \"250 Favourite Films\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_avatar_image_url FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.list_title = '250 Favourite Films'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.user_avatar_image_url FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id AND T1.user_id = T2.user_id WHERE T1.list_title = '250 Favourite Films'",
"index": 27,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Avatar', 'Image', 'Avatar 3', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite Films ', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n250 Favourite Films refers to list_title; avatar image refers to user_avatar_image_url;\nWhat's the avatar image of the user who created the movie list \"250 Favourite Films\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite Films ', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n250 Favourite Films refers to list_title;\nHow many more movie lists were created by the user who created the movie list \"250 Favourite Films\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(list_id) FROM lists_users WHERE user_id = ( SELECT user_id FROM lists WHERE list_title = '250 Favourite Films' )",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(list_id) FROM lists_users WHERE user_id = ( SELECT user_id FROM lists WHERE list_title = '250 Favourite Films' )",
"index": 28,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite Films ', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n250 Favourite Films refers to list_title;\nHow many more movie lists were created by the user who created the movie list \"250 Favourite Films\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['A Way of Life', 'The Critic', 'Made', 'Please!', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'please', 'please,', 'please!', 'Films that made your kid sister cry', 'Headscratchers']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nA Way of Life refers to movie_title;\nPlease list all the critics made by the user rating the movie \"A Way of Life\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.critic FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'A Way of Life'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.critic FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'A Way of Life'",
"index": 29,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['A Way of Life', 'The Critic', 'Made', 'Please!', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'please', 'please,', 'please!', 'Films that made your kid sister cry', 'Headscratchers']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nA Way of Life refers to movie_title;\nPlease list all the critics made by the user rating the movie \"A Way of Life\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Imitation of Life', 'Imitation', 'Imitations', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nImitation of Life refers to movie_title; critics got more than 1 like refers to critic_likes >1;\nHow many critics of the movie \"Imitation of Life\" got more than 1 like?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Imitation of Life' AND T1.critic_likes > 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Imitation of Life' AND T1.critic_likes > 1",
"index": 30,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Imitation of Life', 'Imitation', 'Imitations', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nImitation of Life refers to movie_title; critics got more than 1 like refers to critic_likes >1;\nHow many critics of the movie \"Imitation of Life\" got more than 1 like?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['When Will I Be Loved', 'The Critic', 'Made', 'When', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nWhen Will I Be Loved refers to movie_title; 2 comments for the critic refers to critic_comments = 2;\nWhich user made a critic for the film \"When Will I Be Loved\" and got 2 comments for the critic?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'When Will I Be Loved' AND T1.critic_comments = 2",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'When Will I Be Loved' AND T1.critic_comments = 2",
"index": 31,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['When Will I Be Loved', 'The Critic', 'Made', 'When', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nWhen Will I Be Loved refers to movie_title; 2 comments for the critic refers to critic_comments = 2;\nWhich user made a critic for the film \"When Will I Be Loved\" and got 2 comments for the critic?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Rate', 'rate', 'no rating', 'To Rate', 'to rate']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['A Way of Life', 'When', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nA Way of Life' refers to movie_title; user 39115684 refers to userid = 39115684; when the user rate refers to rating_timestamp_utc;\nWhen did user 39115684 rate the movie \"A Way of Life\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'A Way of Life' AND T1.user_id = 39115684",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'A Way of Life' AND T1.user_id = 39115684",
"index": 32,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Rate', 'rate', 'no rating', 'To Rate', 'to rate']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['A Way of Life', 'When', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nA Way of Life' refers to movie_title; user 39115684 refers to userid = 39115684; when the user rate refers to rating_timestamp_utc;\nWhen did user 39115684 rate the movie \"A Way of Life\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['La Antena', 'Elementary Particles']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 58149469 refers to user_id = 58149469; critic with 1 like refers to critic_likes = 1; critic with 2 comments refers to critic_comments = 2;\nUser 58149469's critic on which film got 1 like and 2 comments?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 58149469 AND T1.critic_likes = 1 AND T1.critic_comments = 2",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 58149469 AND T1.critic_likes = 1 AND T1.critic_comments = 2",
"index": 33,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['La Antena', 'Elementary Particles']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 58149469 refers to user_id = 58149469; critic with 1 like refers to critic_likes = 1; critic with 2 comments refers to critic_comments = 2;\nUser 58149469's critic on which film got 1 like and 2 comments?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['When Will I Be Loved', 'Users', 'Them', 'When', 'La Antena', 'Elementary Particles']\n movie_title_language text, -- example: ['en']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Rated', 'have', 'Rate', 'rate', 'no rating']\n list_movie_number integer, -- example: [5, 3]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nWhen Will I Be Loved refers to movie_title; the user was a trialist when he rated the movie refers to user_trialist = 1;rated 1 on the movie refers to rating_score = 1;\nAmong the users who are trailists when rating the movie \"When Will I Be Loved\", how many of them have rated \"1\" on the movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'When Will I Be Loved' AND T1.rating_score = 1 AND T1.user_trialist = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'When Will I Be Loved' AND T1.rating_score = 1 AND T1.user_trialist = 1",
"index": 34,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['When Will I Be Loved', 'Users', 'Them', 'When', 'La Antena', 'Elementary Particles']\n movie_title_language text, -- example: ['en']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Rated', 'have', 'Rate', 'rate', 'no rating']\n list_movie_number integer, -- example: [5, 3]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nWhen Will I Be Loved refers to movie_title; the user was a trialist when he rated the movie refers to user_trialist = 1;rated 1 on the movie refers to rating_score = 1;\nAmong the users who are trailists when rating the movie \"When Will I Be Loved\", how many of them have rated \"1\" on the movie?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS', 'Favourite Films']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Innocence Unprotected', 'Innocence', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['Innocence.', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nInnocence Unprotected' is movie_title; '250 Favourite Films' is list_title; rating refers to rating_score;\nWhat's of rating on the movie \"Innocence Unprotected\" by the user who created the movie list \"250 Favourite Films\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists AS T3 ON T3.user_id = T1.user_id WHERE T2.movie_title = 'Innocence Unprotected' AND T3.list_title = '250 Favourite Films'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists AS T3 ON T3.user_id = T1.user_id WHERE T2.movie_title = 'Innocence Unprotected' AND T3.list_title = '250 Favourite Films'",
"index": 35,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['250 Favourite Films', 'Favourite films', 'Favourite FILMS', 'Favourite fiLms', 'FAVOURITE FILMS', 'Favourite Films']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Innocence Unprotected', 'Innocence', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['Innocence.', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nInnocence Unprotected' is movie_title; '250 Favourite Films' is list_title; rating refers to rating_score;\nWhat's of rating on the movie \"Innocence Unprotected\" by the user who created the movie list \"250 Favourite Films\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Released in 2012', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfilm released in 2007 refers to movie_release_year = 2007; film refers to movie\nHow many films were released in 2007?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT COUNT(*) FROM movies WHERE movie_release_year = 2007",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(*) FROM movies WHERE movie_release_year = 2007",
"index": 36,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Released in 2012', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfilm released in 2007 refers to movie_release_year = 2007; film refers to movie\nHow many films were released in 2007?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'Director', 'Popular', 'Users', 'Most', 'Alex']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Directed By', 'the most', 'The most', 'director', 'Popular', 'Mubi ']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlex de la Iclesia is the director name; the most popular refers to Max(movie_popularity); films refers to movies;\nWhich of the films directed by Álex de la Iclesia is the most popular among Mubi 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 movie_title FROM movies WHERE director_name = 'Åke Sandgren' ORDER BY movie_popularity DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_title FROM movies WHERE director_name = 'Åke Sandgren' ORDER BY movie_popularity DESC LIMIT 1",
"index": 37,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'Director', 'Popular', 'Users', 'Most', 'Alex']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Directed By', 'the most', 'The most', 'director', 'Popular', 'Mubi ']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAlex de la Iclesia is the director name; the most popular refers to Max(movie_popularity); films refers to movies;\nWhich of the films directed by Álex de la Iclesia is the most popular among Mubi 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 lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Cops', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'When', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nCops' is movie_title; released refers to movie_release_year;\nWhen was the movie Cops released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_release_year FROM movies WHERE movie_title = 'Cops'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_release_year FROM movies WHERE movie_title = 'Cops'",
"index": 38,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Cops', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'When', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nCops' is movie_title; released refers to movie_release_year;\nWhen was the movie Cops released?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['director', 'please', 'winter', 'Winter', 'Directors', 'DIRECTORS']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', \"It's Winter\", 'Director', 'The Id', 'Winter', 'ID']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIt's Winter' is movie_title;\nPlease list the id of the director of the movie \"It's Winter\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT director_id FROM movies WHERE movie_title = 'It''s Winter'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT director_id FROM movies WHERE movie_title = 'It''s Winter'",
"index": 39,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['director', 'please', 'winter', 'Winter', 'Directors', 'DIRECTORS']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', \"It's Winter\", 'Director', 'The Id', 'Winter', 'ID']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIt's Winter' is movie_title;\nPlease list the id of the director of the movie \"It's Winter\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'please', 'Max', 'please,', 'please!']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'The Id', 'Follow', 'Most', 'Max', 'ID']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmost followers refers to Max(list_followers);\nPlease provide the ID of the user with the most followers on the list.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT user_id FROM lists ORDER BY list_followers DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT user_id FROM lists ORDER BY list_followers DESC LIMIT 1",
"index": 40,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'please', 'Max', 'please,', 'please!']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'The Id', 'Follow', 'Most', 'Max', 'ID']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmost followers refers to Max(list_followers);\nPlease provide the ID of the user with the most followers on the list.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'Score', 'Max', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfilm released in 2008 refers to movie_release_year = 2008; scored the highest refers to Max(rating_score); film refers to movie;\nWhich of the film released in 2008 scored the highest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year = 2008 ORDER BY T1.rating_score DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year = 2008 ORDER BY T1.rating_score DESC LIMIT 1",
"index": 41,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Release', 'Score', 'Max', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfilm released in 2008 refers to movie_release_year = 2008; scored the highest refers to Max(rating_score); film refers to movie;\nWhich of the film released in 2008 scored the highest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Number', 'The Critic', 'Three', 'Made', 'Max', 'A Number']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nlikes related to the critic made by the user rating the movie refers to critic_likes; top refers to Max(critic_likes);\nPlease list the names of the top three movies in the number of likes related to the critic made by the user rating the movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_likes DESC LIMIT 3",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_likes DESC LIMIT 3",
"index": 42,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Number', 'The Critic', 'Three', 'Made', 'Max', 'A Number']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nlikes related to the critic made by the user rating the movie refers to critic_likes; top refers to Max(critic_likes);\nPlease list the names of the top three movies in the number of likes related to the critic made by the user rating the movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_followers integer, -- example: [5, 1]\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 100 followers refers to list_followers >100; list created by the user in 2009 refers to list_creation_date_utc = '2009';\nHow many users have more than 100 followers in the list created by users in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT COUNT(T1.user_id) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers > 100 AND T1.list_creation_date_utc LIKE '2009%'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.user_id) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers > 100 AND T1.list_creation_date_utc LIKE '2009%'",
"index": 43,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_followers integer, -- example: [5, 1]\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 100 followers refers to list_followers >100; list created by the user in 2009 refers to list_creation_date_utc = '2009';\nHow many users have more than 100 followers in the list created by users in 2009?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'Please!', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['please', 'Score', 'please,', 'please!', 'Films that made your kid sister cry', 'Headscratchers']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 94978 refers to user_id = 94978; scored as 5 refers to rating_score = 5;\nPlease list the names of the movies that user 94978 scored as 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 T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 5 AND T1.user_id = 94978",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 5 AND T1.user_id = 94978",
"index": 44,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'Please!', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['please', 'Score', 'please,', 'please!', 'Films that made your kid sister cry', 'Headscratchers']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 94978 refers to user_id = 94978; scored as 5 refers to rating_score = 5;\nPlease list the names of the movies that user 94978 scored as 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 ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Patti Smith: Dream of Life', 'Users', 'When', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPatti Smith: Dream of Life' is movie_title; the user was not a trialist when he created the list refers to user_trialist = 0;\nHow many users were not trialists when they rated the movie \"Patti Smith: Dream of Life\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Patti Smith: Dream of Life' AND T1.user_trialist = 0",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Patti Smith: Dream of Life' AND T1.user_trialist = 0",
"index": 45,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Patti Smith: Dream of Life', 'Users', 'When', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPatti Smith: Dream of Life' is movie_title; the user was not a trialist when he created the list refers to user_trialist = 0;\nHow many users were not trialists when they rated the movie \"Patti Smith: Dream of Life\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'Max', 'La Antena', 'Elementary Particles']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nHighest average score refers to Max(Avg(rating_score));\nWhich movie has the highest average score in Mubi?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id GROUP BY T2.movie_title ORDER BY SUM(T1.rating_score) / COUNT(T1.rating_id) DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id GROUP BY T2.movie_title ORDER BY SUM(T1.rating_score) / COUNT(T1.rating_id) DESC LIMIT 1",
"index": 46,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Score', 'Max', 'La Antena', 'Elementary Particles']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nHighest average score refers to Max(Avg(rating_score));\nWhich movie has the highest average score in Mubi?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['First list', 'FIRST LIST', 'First List', 'please', 'create', 'Title']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 85981819 refers to user_id = 85981819; first list created refers to Min (list_creation_date_utc);\nWhat was the title of the first list created by a user 85981819? And please provide the user_avatar_image_url.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.list_title, T1.user_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_id = 85981819 ORDER BY T2.list_creation_timestamp_utc LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.list_title, T1.user_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_id = 85981819 ORDER BY T2.list_creation_timestamp_utc LIMIT 1",
"index": 47,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['First list', 'FIRST LIST', 'First List', 'please', 'create', 'Title']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 85981819 refers to user_id = 85981819; first list created refers to Min (list_creation_date_utc);\nWhat was the title of the first list created by a user 85981819? And please provide the user_avatar_image_url.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Count', 'Most', 'Max', 'Please!', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'IN 2020', 'please', 'rating', 'Rated']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nin 2020 refers to rating_timestamp_utc = '2020%'; rated the most times refers to Max(Count(movie_title));\nPlease list the names of the movies that have been rated the most times in 2020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_timestamp_utc LIKE '2020%' GROUP BY T2.movie_title ORDER BY COUNT(T2.movie_title) DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_timestamp_utc LIKE '2020%' GROUP BY T2.movie_title ORDER BY COUNT(T2.movie_title) DESC LIMIT 1",
"index": 48,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Count', 'Most', 'Max', 'Please!', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'IN 2020', 'please', 'rating', 'Rated']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nin 2020 refers to rating_timestamp_utc = '2020%'; rated the most times refers to Max(Count(movie_title));\nPlease list the names of the movies that have been rated the most times in 2020.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Versailles Rive-Gauche', 'The Average', 'Versailles', 'Score', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nVersailles Rive-Gauche' is movie_title; average score refers to Avg(rating_score);\nWhat is the average score for the movie Versailles Rive-Gauche?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title LIKE 'Versailles Rive-Gauche'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title LIKE 'Versailles Rive-Gauche'",
"index": 49,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Versailles Rive-Gauche', 'The Average', 'Versailles', 'Score', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n user_id integer, -- example: [41579158, 85981819]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nVersailles Rive-Gauche' is movie_title; average score refers to Avg(rating_score);\nWhat is the average score for the movie Versailles Rive-Gauche?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['please', 'please,', 'please!', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Receiver', 'Please!', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nreceived more than 20 likes refers to critic_likes>20;\nPlease list the names of the movies that received more than 20 likes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.critic_likes > 20",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.critic_likes > 20",
"index": 50,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['please', 'please,', 'please!', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Receiver', 'Please!', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nreceived more than 20 likes refers to critic_likes>20;\nPlease list the names of the movies that received more than 20 likes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nyear refers to movie_release_year; most release films refers to MAX(COUNT(movie_id))\n\n\nWhich year had the most released films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT movie_release_year FROM movies GROUP BY movie_release_year ORDER BY COUNT(movie_id) DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT movie_release_year FROM movies GROUP BY movie_release_year ORDER BY COUNT(movie_id) DESC LIMIT 1",
"index": 51,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nyear refers to movie_release_year; most release films refers to MAX(COUNT(movie_id))\n\n\nWhich year had the most released films?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Number', 'After', 'When', 'A Number', 'Numbers', 'La Antena']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['YEAR 2014', 'rating', 'no rating', 'number 1', 'Number 2', 'Numbers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\npaying subscribers refers to user_has_payment_method = 1; rating a movie after the year 2014 refers to rating_date_utc>'2014%'\nWhat's the number of the paying subscribers when rating a movie after the year 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT COUNT(user_subscriber) FROM ratings_users WHERE user_has_payment_method = 1 AND rating_date_utc > '2014%'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(user_subscriber) FROM ratings_users WHERE user_has_payment_method = 1 AND rating_date_utc > '2014%'",
"index": 52,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Number', 'After', 'When', 'A Number', 'Numbers', 'La Antena']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['YEAR 2014', 'rating', 'no rating', 'number 1', 'Number 2', 'Numbers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\npaying subscribers refers to user_has_payment_method = 1; rating a movie after the year 2014 refers to rating_date_utc>'2014%'\nWhat's the number of the paying subscribers when rating a movie after the year 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'ID.', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'Give', 'ID', 'Id', 'Followed']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nearliest user created a list refers to MIN(list_creation_date_utc); didn't get any followers refers to user_subscriber = 0\nWho was the earliest user created a list but didn't get any followers? Give the user 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 user_id FROM lists_users WHERE user_subscriber = 0 ORDER BY list_creation_date_utc LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT user_id FROM lists_users WHERE user_subscriber = 0 ORDER BY list_creation_date_utc LIMIT 1",
"index": 53,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'ID.', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'Give', 'ID', 'Id', 'Followed']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nearliest user created a list refers to MIN(list_creation_date_utc); didn't get any followers refers to user_subscriber = 0\nWho was the earliest user created a list but didn't get any followers? Give the user 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 movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Portrait', 'Portrait', 'A Portrait', 'Portraits', 'Pictures', 'Pictured']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Vladimir Vladimirovich Nabokov', 'Portrait', 'create', 'portraits', 'Portraits', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe list \"Vladimir Vladimirovich Nabokov\" refers to list_title = 'Vladimir Vladimirovich Nabokov'; portrait picture refers to user_avatar_image_url\nShow the portrait picture of the user who created the list \"Vladimir Vladimirovich Nabokov\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_title LIKE 'Vladimir Vladimirovich Nabokov'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.user_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_title LIKE 'Vladimir Vladimirovich Nabokov'",
"index": 54,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Portrait', 'Portrait', 'A Portrait', 'Portraits', 'Pictures', 'Pictured']\n movie_release_year integer, -- example: [2007, 2006]\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Vladimir Vladimirovich Nabokov', 'Portrait', 'create', 'portraits', 'Portraits', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe list \"Vladimir Vladimirovich Nabokov\" refers to list_title = 'Vladimir Vladimirovich Nabokov'; portrait picture refers to user_avatar_image_url\nShow the portrait picture of the user who created the list \"Vladimir Vladimirovich Nabokov\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'Popular', 'GOT', 'Got', 'Max']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'Given', 'Most', 'Max', 'A Number', 'Numbers']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost movie popularity number refers to MAX(movie_popularity)\nHow many critics were given to the movie that got the most movie popularity number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT COUNT(T1.critic) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_popularity = ( SELECT MAX(movie_popularity) FROM movies )",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.critic) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_popularity = ( SELECT MAX(movie_popularity) FROM movies )",
"index": 55,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['the most', 'The most', 'Popular', 'GOT', 'Got', 'Max']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'Given', 'Most', 'Max', 'A Number', 'Numbers']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost movie popularity number refers to MAX(movie_popularity)\nHow many critics were given to the movie that got the most movie popularity number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Freaks', 'Freak', 'Give', '5/4', 'ID', 'Id']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2013-05-04 06:33:32', '2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['freak', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 rating refers to rating_score = 4; the movie \"Freaks\" refers to movie_title = 'Freaks' ; at 2013/5/4 6:33:32 refers to rating_timestamp_utc = '2013-05-04 06:33:32'\nWho gave a \"4\" rating to the movie \"Freaks\" at 2013/5/4 6:33:32? Give his/her user 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 T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE rating_score = 4 AND rating_timestamp_utc LIKE '2013-05-04 06:33:32' AND T2.movie_title LIKE 'Freaks'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE rating_score = 4 AND rating_timestamp_utc LIKE '2013-05-04 06:33:32' AND T2.movie_title LIKE 'Freaks'",
"index": 56,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Freaks', 'Freak', 'Give', '5/4', 'ID', 'Id']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2013-05-04 06:33:32', '2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['freak', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 rating refers to rating_score = 4; the movie \"Freaks\" refers to movie_title = 'Freaks' ; at 2013/5/4 6:33:32 refers to rating_timestamp_utc = '2013-05-04 06:33:32'\nWho gave a \"4\" rating to the movie \"Freaks\" at 2013/5/4 6:33:32? Give his/her user 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 movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2013-05-03 05:11:17', '2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['3 5', '3/5', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Rated', 'Rate', 'rate', 'no rating', 'To Rate']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nrated 5 refers to rating_score = 5; on 2013/5/3 5:11:17 refers to rating_timestamp_utc = '2013-05-03 05:11:17'\nGive the url of movie which was rated 5 on 2013/5/3 5:11:17.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE rating_score = 5 AND rating_timestamp_utc LIKE '2013-05-03 05:11:17'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE rating_score = 5 AND rating_timestamp_utc LIKE '2013-05-03 05:11:17'",
"index": 57,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2013-05-03 05:11:17', '2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['3 5', '3/5', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Rated', 'Rate', 'rate', 'no rating', 'To Rate']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nrated 5 refers to rating_score = 5; on 2013/5/3 5:11:17 refers to rating_timestamp_utc = '2013-05-03 05:11:17'\nGive the url of movie which was rated 5 on 2013/5/3 5:11:17.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Popular', 'rating', 'GOT', 'Got', 'Max', 'no rating']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'Max', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1998 movie refers to movie_release_year = '1998'; the highest popularity refers to MAX(movie_popularity) ; \"4\" rating refers to rating_score = 4\nFor the 1998 movie which got the highest popularity, how many \"4\" rating did the movie 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.movie_title) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 4 AND T2.movie_release_year = 1998 ORDER BY T2.movie_popularity DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T2.movie_title) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 4 AND T2.movie_release_year = 1998 ORDER BY T2.movie_popularity DESC LIMIT 1",
"index": 58,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Popular', 'rating', 'GOT', 'Got', 'Max', 'no rating']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'Max', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1998 movie refers to movie_release_year = '1998'; the highest popularity refers to MAX(movie_popularity) ; \"4\" rating refers to rating_score = 4\nFor the 1998 movie which got the highest popularity, how many \"4\" rating did the movie 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 movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'A Number', 'Numbers', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 13000 popularity number refers to movie_popularity > 13000; least ratings refers to MIN(rating_score)\nFrom all the movies that got more than 13000 popularity number, which one had the least 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 T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_popularity > 13000 ORDER BY T1.rating_score LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_popularity > 13000 ORDER BY T1.rating_score LIMIT 1",
"index": 59,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'A Number', 'Numbers', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmore than 13000 popularity number refers to movie_popularity > 13000; least ratings refers to MIN(rating_score)\nFrom all the movies that got more than 13000 popularity number, which one had the least 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 movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'Users', 'Followed', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'GOT', 'Got', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 more than 3000 followers refers to list_followers > 3000; paying subscribers refer to user_has_payment_method = 1\nFor the lists that got more than 3000 followers, how many did the users who created those lists are paying subscribers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers > 3000 AND T1.user_has_payment_method = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.user_id) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers > 3000 AND T1.user_has_payment_method = 1",
"index": 60,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Follower', 'Follow', 'Users', 'Followed', 'La Antena', 'Elementary Particles']\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'GOT', 'Got', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 more than 3000 followers refers to list_followers > 3000; paying subscribers refer to user_has_payment_method = 1\nFor the lists that got more than 3000 followers, how many did the users who created those lists are paying subscribers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Percentage', 'G.I. Jane', 'Divide', 'Count', 'Give', 'Jane']\n movie_release_year integer, -- example: [2007, 2006]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Rated', 'Rate', 'rate', 'JANE', 'To Rate', 'to rate']\n list_movie_number integer, -- example: [5, 3]\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie \"G.I. Jane\" refers to movie_title = 'G.I. Jane'; subscribers refers to user_subscriber = 1; percentage refers to DIVIDE(COUNT(user_subscriber = 1),COUNT(user_subscriber))*100\nGive the percentage of subscribers who rated who rated the movie \"G.I. Jane\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'G.I. Jane'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T3.user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'G.I. Jane'",
"index": 61,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Percentage', 'G.I. Jane', 'Divide', 'Count', 'Give', 'Jane']\n movie_release_year integer, -- example: [2007, 2006]\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Rated', 'Rate', 'rate', 'JANE', 'To Rate', 'to rate']\n list_movie_number integer, -- example: [5, 3]\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovie \"G.I. Jane\" refers to movie_title = 'G.I. Jane'; subscribers refers to user_subscriber = 1; percentage refers to DIVIDE(COUNT(user_subscriber = 1),COUNT(user_subscriber))*100\nGive the percentage of subscribers who rated who rated the movie \"G.I. Jane\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['A Shot in the Dark', 'Percentage', 'Divide', 'A Shot', 'Users', 'Count']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_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\"A Shot in the Dark\" refers to movie_title = 'A Shot in the Dark'; paying subscriber refers to user_has_payment_method = 1; percentage refers to DIVIDE(COUNT(user_has_payment_method = 1),COUNT(user_has_payment_method))*100\nFor all the users who gave \"A Shot in the Dark\" a rating, how many percent of them is a paying subscriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.user_has_payment_method = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'A Shot in the Dark'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.user_has_payment_method = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'A Shot in the Dark'",
"index": 62,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['rating', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['A Shot in the Dark', 'Percentage', 'Divide', 'A Shot', 'Users', 'Count']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_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\"A Shot in the Dark\" refers to movie_title = 'A Shot in the Dark'; paying subscriber refers to user_has_payment_method = 1; percentage refers to DIVIDE(COUNT(user_has_payment_method = 1),COUNT(user_has_payment_method))*100\nFor all the users who gave \"A Shot in the Dark\" a rating, how many percent of them is a paying subscriber?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Title', 'title', 'Titles.', 'Films that made your kid sister cry', 'Headscratchers']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 4208563 refers to user_id = 4208563\nName all the list titles created by user 4208563.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT list_title FROM lists WHERE user_id LIKE 4208563",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT list_title FROM lists WHERE user_id LIKE 4208563",
"index": 63,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Title', 'title', 'Titles.', 'Films that made your kid sister cry', 'Headscratchers']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 4208563 refers to user_id = 4208563\nName all the list titles created by user 4208563.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Most', 'Max', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['IN 2016', 'in 2016', 'Recent', 'create', 'Max', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ncreated in 2016 refers to list_creation_timestamp_utc like '2016%'; updated most recently refers to MAX(list_update_timestamp_utc)\nAmong the lists created in 2016, which is the list that was updated most recently.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT list_title FROM lists WHERE strftime('%Y', list_update_timestamp_utc) = '2016' ORDER BY list_update_timestamp_utc DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT list_title FROM lists WHERE strftime('%Y', list_update_timestamp_utc) = '2016' ORDER BY list_update_timestamp_utc DESC LIMIT 1",
"index": 64,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Most', 'Max', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['IN 2016', 'in 2016', 'Recent', 'create', 'Max', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ncreated in 2016 refers to list_creation_timestamp_utc like '2016%'; updated most recently refers to MAX(list_update_timestamp_utc)\nAmong the lists created in 2016, which is the list that was updated most recently.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_popularity integer, -- example: [105, 23]\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwas a subscriber refers to user_subscriber = 1; percentage refers to DIVIDE(COUNT(user_subscriber = 1),COUNT(list_id))\nWhat is the percentage of list created by user who was a subscriber when he created the list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT CAST(SUM(CASE WHEN user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(list_id) FROM lists_users",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(list_id) FROM lists_users",
"index": 65,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_popularity integer, -- example: [105, 23]\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwas a subscriber refers to user_subscriber = 1; percentage refers to DIVIDE(COUNT(user_subscriber = 1),COUNT(list_id))\nWhat is the percentage of list created by user who was a subscriber when he created the list?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Trial', 'When', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Title', 'title', 'Titles.', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\neligible for trial refers to user_eligible_for_trial = 1\nProvide list titles created by user who are eligible for trial when he created the list.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT DISTINCT T2.list_title FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_eligible_for_trial = 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT DISTINCT T2.list_title FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_eligible_for_trial = 1",
"index": 66,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Trial', 'When', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['create', 'Title', 'title', 'Titles.', 'Films that made your kid sister cry', 'Headscratchers']\n list_movie_number integer, -- example: [5, 3]\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\neligible for trial refers to user_eligible_for_trial = 1\nProvide list titles created by user who are eligible for trial when he created the list.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['period', 'how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['period ', 'Period', 'period', 'Title', 'title', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['State', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot been updated for the longest period of time refers to MIN(list_update_timestamp_utc); how long it has not been updated refers to SUBTRACT(CURRENT_TIMESTAMP, list_update_timestamp_utc)\nWhich title list has not been updated for the longest period of time? State how long it has not been updated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT list_title , datetime(CURRENT_TIMESTAMP, 'localtime') - datetime(list_update_timestamp_utc) FROM lists ORDER BY list_update_timestamp_utc LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT list_title , datetime(CURRENT_TIMESTAMP, 'localtime') - datetime(list_update_timestamp_utc) FROM lists ORDER BY list_update_timestamp_utc LIMIT 1",
"index": 67,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['period', 'how', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['period ', 'Period', 'period', 'Title', 'title', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['State', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot been updated for the longest period of time refers to MIN(list_update_timestamp_utc); how long it has not been updated refers to SUBTRACT(CURRENT_TIMESTAMP, list_update_timestamp_utc)\nWhich title list has not been updated for the longest period of time? State how long it has not been updated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Percentage', 'Divide', 'Count', 'Never', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['All Movies', 'rating', 'Rated', 'Rate', 'rate', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 of movies that were never been rated refers to DIVIDE(COUNT(main_movies.movie_id ! = main_ratings.movie_id),COUNT(movie_id))\nAmong all movies in the list, calculate the percentage of movies that were never been rated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_id IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.movie_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.movie_id IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.movie_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id",
"index": 68,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Percentage', 'Divide', 'Count', 'Never', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['All Movies', 'rating', 'Rated', 'Rate', 'rate', 'Films that made your kid sister cry']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 of movies that were never been rated refers to DIVIDE(COUNT(main_movies.movie_id ! = main_ratings.movie_id),COUNT(movie_id))\nAmong all movies in the list, calculate the percentage of movies that were never been rated?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['All Movies', 'rating', 'Score', 'Rated', 'Title', 'title']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Title', 'Score', 'State', 'Date', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 39115684 refers to user_id = 39115684; title refers to movie_title; rating date refers to rating_timestamp_utc\n\nList all movies rated by user 39115684. State the title, rating date and rating score.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.movie_title, T1.rating_timestamp_utc, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 39115684",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title, T1.rating_timestamp_utc, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 39115684",
"index": 69,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['All Movies', 'rating', 'Score', 'Rated', 'Title', 'title']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Title', 'Score', 'State', 'Date', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['score', 'no rating', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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 39115684 refers to user_id = 39115684; title refers to movie_title; rating date refers to rating_timestamp_utc\n\nList all movies rated by user 39115684. State the title, rating date and rating score.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'Score', 'Most', 'Max', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Jeannot Szwarc', 'Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nJeannot Szwarc's refers to director_name = 'Jeannot Szwarc'; most popular movie refers to MAX(movie_popularity); average rating score refers to avg(rating_score)\nWhat is Jeannot Szwarc's most popular movie and what is its average rating score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.movie_title, AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Jeannot Szwarc' ORDER BY T2.movie_popularity DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title, AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Jeannot Szwarc' ORDER BY T2.movie_popularity DESC LIMIT 1",
"index": 70,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n user_subscriber integer, -- example: [1, 0]\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Popular', 'Score', 'Most', 'Max', 'La Antena', 'Elementary Particles']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Jeannot Szwarc', 'Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nJeannot Szwarc's refers to director_name = 'Jeannot Szwarc'; most popular movie refers to MAX(movie_popularity); average rating score refers to avg(rating_score)\nWhat is Jeannot Szwarc's most popular movie and what is its average rating score?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'Director', 'Between', 'Users', 'Score', 'Count']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nhighest number of movies COUNT(T1.movie_id); in the 70s refers to movie_release_year between 1970 and 1979\nWho is the director that directed the highest number of movies in the 70s? If there are multiple directors with the same amount of movies, list all of their names and indicate the highest rating score that those movies got from the users.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.director_name, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year BETWEEN 1970 AND 1979 GROUP BY T2.director_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.director_name, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year BETWEEN 1970 AND 1979 GROUP BY T2.director_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1",
"index": 71,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_likes integer, -- example: [0, 1]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'Director', 'Between', 'Users', 'Score', 'Count']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nhighest number of movies COUNT(T1.movie_id); in the 70s refers to movie_release_year between 1970 and 1979\nWho is the director that directed the highest number of movies in the 70s? If there are multiple directors with the same amount of movies, list all of their names and indicate the highest rating score that those movies got from the 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 ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Secret Life of Words', 'Secret Life', 'The Secret', 'Between', 'Users', 'Score']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nBetween 1/1/2010 to 12/31/2020 refers to rating_timestamp_utc between '2010-01-01%' and '2020-12-31%'; a trialist refers to user_trialist = 1; movie \"The Secret Life of Words\" refers to movie_title = 'The Secret Life of Words'; rating score of 3 refers to rating_score = 3\nBetween 1/1/2010 to 12/31/2020, how many users, who were a trialist when they created the list, gave the movie \"The Secret Life of Words\" a rating score of 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(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'The Secret Life of Words' AND T1.rating_score = 3 AND T1.user_trialist = 0 AND T1.rating_timestamp_utc BETWEEN '2010%' AND '2020%'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'The Secret Life of Words' AND T1.rating_score = 3 AND T1.user_trialist = 0 AND T1.rating_timestamp_utc BETWEEN '2010%' AND '2020%'",
"index": 72,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Secret Life of Words', 'Secret Life', 'The Secret', 'Between', 'Users', 'Score']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nBetween 1/1/2010 to 12/31/2020 refers to rating_timestamp_utc between '2010-01-01%' and '2020-12-31%'; a trialist refers to user_trialist = 1; movie \"The Secret Life of Words\" refers to movie_title = 'The Secret Life of Words'; rating score of 3 refers to rating_score = 3\nBetween 1/1/2010 to 12/31/2020, how many users, who were a trialist when they created the list, gave the movie \"The Secret Life of Words\" a rating score of 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 lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Max', 'Receiver', 'In the Name Of', 'La Antena', 'Elementary Particles']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ncritic received the highest amount of likes refers to MAX(critic_likes);\nWhat is the name of the movie whose critic received the highest amount of likes? Indicate the URL to the rating on Mubi.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title, T1.rating_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_likes DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title, T1.rating_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_likes DESC LIMIT 1",
"index": 73,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Max', 'Receiver', 'In the Name Of', 'La Antena', 'Elementary Particles']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_subscriber integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\ncritic received the highest amount of likes refers to MAX(critic_likes);\nWhat is the name of the movie whose critic received the highest amount of likes? Indicate the URL to the rating on Mubi.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Patti Smith: Dream of Life', 'The Image', 'Between', 'Image', 'Users', 'Trial']\n movie_release_year integer, -- example: [2007, 2006]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2017-01-01', '2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-01-01 00:00:01', '2017-12-31 00:00:53', '2017-12-31 00:00:32', '2017-06-10 12:38:33', '2014-08-15 23:42:31']\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nBetween 1/1/2017 to 12/31/2017 refers to rating_timestamp_utc between '2017-01-01 00:00:00' and '2017-12-31 00:00:00'; eligible for trial refers to user_eligible_for_trial = 1; movie \"Patti Smith: Dream of Life\" refers to movie_title = 'Patti Smith: Dream of Life'\nBetween 1/1/2017 to 12/31/2017, how many users who were eligible for trial when they rated the movie \"Patti Smith: Dream of Life\"and what is the image URL to the movie on Mubi?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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), T2.movie_image_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE datetime(T1.rating_timestamp_utc) BETWEEN '2017-01-01 00:00:00' AND '2017-12-31 00:00:00'",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT COUNT(T1.user_id), T2.movie_image_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE datetime(T1.rating_timestamp_utc) BETWEEN '2017-01-01 00:00:00' AND '2017-12-31 00:00:00'",
"index": 74,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Patti Smith: Dream of Life', 'The Image', 'Between', 'Image', 'Users', 'Trial']\n movie_release_year integer, -- example: [2007, 2006]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2017-01-01', '2009-12-18', '2010-01-30']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_subscriber integer, -- example: [0, 1]\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-01-01 00:00:01', '2017-12-31 00:00:53', '2017-12-31 00:00:32', '2017-06-10 12:38:33', '2014-08-15 23:42:31']\n user_id integer, -- example: [41579158, 85981819]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nBetween 1/1/2017 to 12/31/2017 refers to rating_timestamp_utc between '2017-01-01 00:00:00' and '2017-12-31 00:00:00'; eligible for trial refers to user_eligible_for_trial = 1; movie \"Patti Smith: Dream of Life\" refers to movie_title = 'Patti Smith: Dream of Life'\nBetween 1/1/2017 to 12/31/2017, how many users who were eligible for trial when they rated the movie \"Patti Smith: Dream of Life\"and what is the image URL to the movie on Mubi?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['average', 'AVERAGE', 'score', 'how', 'no rating', 'average.']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Average', 'Score', 'Give', 'A Number', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 number of number of movies refers to AVG(list_movie_number); user 8516503 refers to user_id = 8516503; rating score of 5 refers to rating_score = 5\nWhat is the average number of number of movies added to the lists of user 8516503? Indicate how many movies did he/she give a rating score of 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 AVG(T3.list_movie_number) , SUM(CASE WHEN T1.rating_score = 5 THEN 1 ELSE 0 END) FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id INNER JOIN lists AS T3 ON T2.user_id = T3.user_id WHERE T1.user_id = 8516503",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT AVG(T3.list_movie_number) , SUM(CASE WHEN T1.rating_score = 5 THEN 1 ELSE 0 END) FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id INNER JOIN lists AS T3 ON T2.user_id = T3.user_id WHERE T1.user_id = 8516503",
"index": 75,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['average', 'AVERAGE', 'score', 'how', 'no rating', 'average.']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Average', 'Score', 'Give', 'A Number', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_eligible_for_trial text, -- example: ['0', '1']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 number of number of movies refers to AVG(list_movie_number); user 8516503 refers to user_id = 8516503; rating score of 5 refers to rating_score = 5\nWhat is the average number of number of movies added to the lists of user 8516503? Indicate how many movies did he/she give a rating score of 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 lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Of all time', 'All Time ', 'ALL TIME', 'All Time', 'All time', 'director']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'The Average', 'Director', 'Release', 'Popular', 'Users']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['average', 'AVERAGE', 'score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmost popular movie of all time refers to MAX(movie_popularity); a trialist refers to user_trialist = 1; average rating score = AVG(rating_score)\nWho is the director of the most popular movie of all time and when was it released? Indicate the average rating score of the users who were on a trialist when they rated the movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.director_name, T1.movie_release_year , SUM(T2.rating_score) / COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_trialist = 1 ORDER BY T1.movie_popularity DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T1.director_name, T1.movie_release_year , SUM(T2.rating_score) / COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_trialist = 1 ORDER BY T1.movie_popularity DESC LIMIT 1",
"index": 76,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Of all time', 'All Time ', 'ALL TIME', 'All Time', 'All time', 'director']\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'The Average', 'Director', 'Release', 'Popular', 'Users']\n movie_release_year integer, -- example: [2007, 2006]\n movie_url text, -- example: ['http://mubi.com/films/la-antena', 'http://mubi.com/films/elementary-particl']\n movie_title_language text, -- example: ['en']\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['average', 'AVERAGE', 'score', 'I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_likes integer, -- example: [0, 1]\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (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:\nmost popular movie of all time refers to MAX(movie_popularity); a trialist refers to user_trialist = 1; average rating score = AVG(rating_score)\nWho is the director of the most popular movie of all time and when was it released? Indicate the average rating score of the users who were on a trialist when they rated the movie.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Recent', 'rating', 'Rated', 'Rate', 'rate', 'Max']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Max', 'In the Name Of', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 57756708 refers to user_id = 57756708; rated recently refers to MAX(rating_timestamp_utc)\nWhat is the name of the movie that was rated recently by user 57756708?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 57756708 ORDER BY T1.rating_timestamp_utc DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 57756708 ORDER BY T1.rating_timestamp_utc DESC LIMIT 1",
"index": 77,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_title text, -- example: ['Recent', 'rating', 'Rated', 'Rate', 'rate', 'Max']\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_followers integer, -- example: [5, 1]\n list_url text, -- example: ['http://mubi.com/lists/films-that-made-yo', 'http://mubi.com/lists/headscratchers']\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_first_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_second_image_url text, -- example: ['https://assets.mubicdn.net/images/film/5', 'https://assets.mubicdn.net/images/film/1']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_id integer, -- example: [15610495, 10704606]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic text, -- example: ['I am a bit disappointed by this document', 'Splendid debut. Whatever happened to Amm']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['Max', 'In the Name Of', 'La Antena', 'Elementary Particles']\n movie_release_year integer, -- example: [2007, 2006]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_id text, -- example: ['131', '73']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_creation_date_utc text, -- example: ['2009-12-18', '2010-01-30']\n user_trialist integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_eligible_for_trial text, -- example: ['0', '1']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_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 57756708 refers to user_id = 57756708; rated recently refers to MAX(rating_timestamp_utc)\nWhat is the name of the movie that was rated recently by user 57756708?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'The Average', 'Director', 'Release', 'Score', 'When']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe average rating score refers to AVG(T2.rating_score); oldest movies refers to MIN(rating_timestamp_utc)\nWhat are the top 10 oldest movies and what are the average rating score for each movie? Indicate the name of the director and when the movies were released.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.movie_id, AVG(T1.rating_score), T2.director_name, T2.movie_release_year FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.rating_timestamp_utc ASC LIMIT 10",
"style": "rule"
}
|
{
"db_id": "movie_platform.sqlite",
"gt_sql": "SELECT T2.movie_id, AVG(T1.rating_score), T2.director_name, T2.movie_release_year FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.rating_timestamp_utc ASC LIMIT 10",
"index": 78,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ratings_users (\n user_id integer, -- example: [41579158, 68654088]\n rating_date_utc text, -- example: ['2017-06-10', '2012-10-02']\n user_trialist integer, -- example: [0, 1]\n user_subscriber integer, -- example: [0, 1]\n user_has_payment_method integer, -- example: [0, 1]\n CONSTRAINT fk_ratings_users_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE movies (\n movie_id integer, -- example: [1, 2]\n movie_title text, -- example: ['The Director', 'The Average', 'Director', 'Release', 'Score', 'When']\n movie_release_year integer, -- example: [2007, 2006]\n movie_popularity integer, -- example: [105, 23]\n movie_image_url text, -- example: ['https://images.mubicdn.net/images/film/1', 'https://images.mubicdn.net/images/film/2']\n director_name text, -- example: ['Esteban Sapir', 'Oskar Roehler']\n director_url text, -- example: ['http://mubi.com/cast/esteban-sapir', 'http://mubi.com/cast/oskar-roehler']\n PRIMARY KEY (movie_id)\n);\n\nCREATE TABLE lists_users (\n user_id integer, -- example: [2385, 15264]\n list_id integer, -- example: [192287, 192313]\n list_update_date_utc text, -- example: ['2019-11-26', '2020-05-01']\n user_subscriber integer, -- example: [1, 0]\n user_avatar_image_url text, -- example: ['https://assets.mubicdn.net/images/avatar', 'https://graph.facebook.com/754931657/pic']\n user_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/cover_']\n user_has_payment_method text, -- example: ['1', '0']\n PRIMARY KEY (user_id, list_id),\n CONSTRAINT fk_lists_users_user_id FOREIGN KEY (user_id) REFERENCES lists (user_id),\n CONSTRAINT fk_lists_users_list_id FOREIGN KEY (list_id) REFERENCES lists (list_id)\n);\n\nCREATE TABLE ratings (\n movie_id integer, -- example: [1066, 1067]\n rating_url text, -- example: ['http://mubi.com/films/pavee-lackeen-the-']\n rating_score integer, -- example: [3, 2]\n rating_timestamp_utc text, -- example: ['2017-06-10 12:38:33', '2014-08-15 23:42:31']\n critic_comments integer, -- example: [0, 2]\n user_id integer, -- example: [41579158, 85981819]\n user_subscriber integer, -- example: [0, 1]\n user_eligible_for_trial integer, -- example: [1, 0]\n CONSTRAINT fk_ratings_movie_id FOREIGN KEY (movie_id) REFERENCES movies (movie_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES ratings_users (user_id),\n CONSTRAINT fk_ratings_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\n\nCREATE TABLE lists (\n user_id integer, -- example: [88260493, 45204418]\n list_id integer, -- example: [1, 2]\n list_movie_number integer, -- example: [5, 3]\n list_update_timestamp_utc text, -- example: ['2019-01-24 19:16:18', '2018-12-03 15:12:20']\n list_creation_timestamp_utc text, -- example: ['2009-11-11 00:02:21', '2009-11-11 00:05:11']\n list_followers integer, -- example: [5, 1]\n list_comments integer, -- example: [3, 2]\n list_description text, -- example: ['<p>Don’t be such a baby!!</p>\\n<p><strong', '<p>Films that need at least two viewings']\n list_cover_image_url text, -- example: ['https://assets.mubicdn.net/images/film/3', 'https://assets.mubicdn.net/images/film/4']\n list_third_image_url text, -- example: ['https://assets.mubicdn.net/images/film/4', 'https://assets.mubicdn.net/images/film/1']\n PRIMARY KEY (list_id),\n CONSTRAINT fk_lists_user_id FOREIGN KEY (user_id) REFERENCES lists_users (user_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe average rating score refers to AVG(T2.rating_score); oldest movies refers to MIN(rating_timestamp_utc)\nWhat are the top 10 oldest movies and what are the average rating score for each movie? Indicate the name of the director and when the movies were released.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal quantity refers to qty; most ordered quantity refers to order with the highest quantity where MAX(count(qty)); date refers to ord_date; year 1992 refers to YEAR(ord_date) = 1992\nWhat is the title with the most ordered quantity in year 1992?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y', T1.ord_date) = '1992' ORDER BY T1.qty DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y', T1.ord_date) = '1992' ORDER BY T1.qty DESC LIMIT 1",
"index": 79,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal quantity refers to qty; most ordered quantity refers to order with the highest quantity where MAX(count(qty)); date refers to ord_date; year 1992 refers to YEAR(ord_date) = 1992\nWhat is the title with the most ordered quantity in year 1992?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['ON invoice', 'Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublication date refers to pubdate; payment terms refers to payterms; payterms = 'ON invoice'\nList the title, price and publication date for all sales with 'ON invoice' payment terms.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T2.title, T2.price, T2.pubdate FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE T1.payterms = 'ON invoice'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T2.title, T2.price, T2.pubdate FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE T1.payterms = 'ON invoice'",
"index": 80,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['ON invoice', 'Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublication date refers to pubdate; payment terms refers to payterms; payterms = 'ON invoice'\nList the title, price and publication date for all sales with 'ON invoice' payment terms.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n state text, -- example: ['WA', 'CA']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nat least 10% royalty refers to royalty > = 10; minimum range is synonym for low range which refers to lorange; without minimum range amount refers to lorange <> 0\nWhat is the title that have at least 10% royalty without minimum range amount.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.title FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange = 0 AND T2.royalty >= 10",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.title FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange = 0 AND T2.royalty >= 10",
"index": 81,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n state text, -- example: ['WA', 'CA']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nat least 10% royalty refers to royalty > = 10; minimum range is synonym for low range which refers to lorange; without minimum range amount refers to lorange <> 0\nWhat is the title that have at least 10% royalty without minimum range amount.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublisher name refers to pub_name;\nProvide a list of titles together with its publisher name for all publishers located in the USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.title, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'USA'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.title, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'USA'",
"index": 82,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublisher name refers to pub_name;\nProvide a list of titles together with its publisher name for all publishers located in the USA.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost year to date sales refers to MAX(ytd_sales); range limit means high range which refers to hirange; the 20000 range refers to hirange<20000\nState the royalty percentage for the most year to date sale title within the 20000 range.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT MAX(T1.ytd_sales) FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 20000 AND T2.hirange < 20000",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT MAX(T1.ytd_sales) FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 20000 AND T2.hirange < 20000",
"index": 83,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost year to date sales refers to MAX(ytd_sales); range limit means high range which refers to hirange; the 20000 range refers to hirange<20000\nState the royalty percentage for the most year to date sale title within the 20000 range.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['CA', 'WA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['CA', 'MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nqty is abbreviation for quantity; sales of quantity more than 20 refers to qty>20; store refers to stor_name\nList all titles with sales of quantity more than 20 and store located in the 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 T1.title, T2.qty FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T2.stor_id = T3.stor_id WHERE T2.qty > 20 AND T3.state = 'CA'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.title, T2.qty FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T2.stor_id = T3.stor_id WHERE T2.qty > 20 AND T3.state = 'CA'",
"index": 84,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['CA', 'WA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['CA', 'MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nqty is abbreviation for quantity; sales of quantity more than 20 refers to qty>20; store refers to stor_name\nList all titles with sales of quantity more than 20 and store located in the 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 authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['S', 'M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nqty is abbreviation for quantity; highest quantity refers to MAX(qty); least quantity refers to MIN(qty)\nName the store with the highest quantity in sales? What is the least quantity title from the store's sale?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stor_id, T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T3.stor_id = T1.stor_id WHERE T3.stor_id = ( SELECT stor_id FROM sales GROUP BY stor_id ORDER BY SUM(qty) DESC LIMIT 1 ) GROUP BY T3.stor_id, T2.title ORDER BY SUM(T1.qty) ASC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T3.stor_id, T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T3.stor_id = T1.stor_id WHERE T3.stor_id = ( SELECT stor_id FROM sales GROUP BY stor_id ORDER BY SUM(qty) DESC LIMIT 1 ) GROUP BY T3.stor_id, T2.title ORDER BY SUM(T1.qty) ASC LIMIT 1",
"index": 85,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['S', 'M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nqty is abbreviation for quantity; highest quantity refers to MAX(qty); least quantity refers to MIN(qty)\nName the store with the highest quantity in sales? What is the least quantity title from the store's sale?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n royalty integer, -- example: [10, 24]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n city text, -- example: ['Seattle', 'Tustin']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname the publisher refers to pub_name\nName the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.title, T3.pub_name, T2.lorange, T2.hirange, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T1.title_id = 'BU2075'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.title, T3.pub_name, T2.lorange, T2.hirange, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T1.title_id = 'BU2075'",
"index": 86,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n royalty integer, -- example: [10, 24]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n city text, -- example: ['Seattle', 'Tustin']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname the publisher refers to pub_name\nName the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 30', 'Net 60']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n state text, -- example: ['MA', 'DC']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore with ID 7066 refers to stor_ID = '7066'; 'Net 60' payment terms refers to payterm = 'Net 60'; qty is abbreviation for quantity; percentage = DIVIDE(payterms = 'Net 60', sum(qty))*100\nName the store with ID 7066 and calculate the percentage of the the quantity ordered that were on 'Net 30' payment terms.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.stor_name , CAST(SUM(CASE WHEN payterms = 'Net 30' THEN qty ELSE 0 END) AS REAL) * 100 / SUM(qty) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T1.stor_id = '7066' GROUP BY T2.stor_name",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T2.stor_name , CAST(SUM(CASE WHEN payterms = 'Net 30' THEN qty ELSE 0 END) AS REAL) * 100 / SUM(qty) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T1.stor_id = '7066' GROUP BY T2.stor_name",
"index": 87,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 30', 'Net 60']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n state text, -- example: ['MA', 'DC']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstore with ID 7066 refers to stor_ID = '7066'; 'Net 60' payment terms refers to payterm = 'Net 60'; qty is abbreviation for quantity; percentage = DIVIDE(payterms = 'Net 60', sum(qty))*100\nName the store with ID 7066 and calculate the percentage of the the quantity ordered that were on 'Net 30' payment terms.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n advance real, -- example: [5000.0, 10125.0]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n state text, -- example: ['MA', 'DC']\n PRIMARY KEY (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhired before year 1990 refers to YEAR(hire_date)<1990\nName all employees who were hired before year 1990.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT fname, lname FROM employee WHERE STRFTIME('%Y', hire_date) < '1990'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT fname, lname FROM employee WHERE STRFTIME('%Y', hire_date) < '1990'",
"index": 88,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n advance real, -- example: [5000.0, 10125.0]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n state text, -- example: ['MA', 'DC']\n PRIMARY KEY (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhired before year 1990 refers to YEAR(hire_date)<1990\nName all employees who were hired before year 1990.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest job level refers to MIN(job_lvl)\nWhich employee has the lowest job level. State the first name, last name and when he /she was hired.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT fname, lname, hire_date FROM employee ORDER BY job_lvl LIMIT 1",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT fname, lname, hire_date FROM employee ORDER BY job_lvl LIMIT 1",
"index": 89,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest job level refers to MIN(job_lvl)\nWhich employee has the lowest job level. State the first name, last name and when he /she was hired.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n pub_id text, -- publisher id, example: ['1389', '0736']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost hired employees refers to MAX(count(emp_id))\nIn which year has the most hired employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT STRFTIME('%Y', hire_date) FROM employee GROUP BY STRFTIME('%Y', hire_date) ORDER BY COUNT(emp_id) DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT STRFTIME('%Y', hire_date) FROM employee GROUP BY STRFTIME('%Y', hire_date) ORDER BY COUNT(emp_id) DESC LIMIT 1",
"index": 90,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n pub_id text, -- publisher id, example: ['1389', '0736']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost hired employees refers to MAX(count(emp_id))\nIn which year has the most hired employees?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmaximum level in their job designation refers to job_lvl = MAX(max_lvl)\nList all employees who are at the maximum level in their job designation.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.fname, T1.lname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl = T2.max_lvl",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.fname, T1.lname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl = T2.max_lvl",
"index": 91,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmaximum level in their job designation refers to job_lvl = MAX(max_lvl)\nList all employees who are at the maximum level in their job designation.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Chief Executive Officer', 'New Hire - Job not specified']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChief Financial Offer is a job description which refers to job_desc\nName the Chief Executive Officer and when he/she was hired.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.fname, T1.lname, T1.hire_date FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T2.job_desc = 'Chief Financial Officier'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.fname, T1.lname, T1.hire_date FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T2.job_desc = 'Chief Financial Officier'",
"index": 92,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Chief Executive Officer', 'New Hire - Job not specified']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nChief Financial Offer is a job description which refers to job_desc\nName the Chief Executive Officer and when he/she was hired.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['S', 'M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot located at USA refers to country! = 'USA'\nWho are the employees working for publisher not located in USA? State the employee's name and publisher name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.fname, T1.lname, T2.pub_name FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country != 'USA'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.fname, T1.lname, T2.pub_name FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country != 'USA'",
"index": 93,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['S', 'M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot located at USA refers to country! = 'USA'\nWho are the employees working for publisher not located in USA? State the employee's name and publisher name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['G', 'M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['GGG&G', 'New Moon Books', 'Binnet & Hardley']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname = fname, lname; job description refers to job_desc; publisher refers pub_name\nList all employees working for publisher 'GGG&G'. State their name and job description.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.fname, T1.lname, T3.job_desc FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id INNER JOIN jobs AS T3 ON T1.job_id = T3.job_id WHERE T2.pub_name = 'GGG&G'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.fname, T1.lname, T3.job_desc FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id INNER JOIN jobs AS T3 ON T1.job_id = T3.job_id WHERE T2.pub_name = 'GGG&G'",
"index": 94,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['G', 'M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['GGG&G', 'New Moon Books', 'Binnet & Hardley']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname = fname, lname; job description refers to job_desc; publisher refers pub_name\nList all employees working for publisher 'GGG&G'. State their name and job description.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['Binnet & Hardley', 'New Moon Books']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished by refers to pub_name\nName the title with the highest price published by 'Binnet & Hardley'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'Binnet & Hardley' ORDER BY T1.price DESC LIMIT 1",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'Binnet & Hardley' ORDER BY T1.price DESC LIMIT 1",
"index": 95,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['Binnet & Hardley', 'New Moon Books']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['Publisher', 'New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished by refers to pub_name\nName the title with the highest price published by 'Binnet & Hardley'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n state text, -- example: ['WA', 'CA']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njob level greater than 200 refers to job_lvl>200; job description refers to job_desc\nAmong all employees, who have job level greater than 200. State the employee name and job description.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.fname, T1.lname, T2.job_desc FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl > 200",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.fname, T1.lname, T2.job_desc FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl > 200",
"index": 96,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n city text, -- example: ['Boston', 'Washington']\n state text, -- example: ['MA', 'DC']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n state text, -- example: ['WA', 'CA']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n hire_date datetime, -- example: ['1991-10-26 00:00:00.0', '1990-02-21 00:00:00.0']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n state text, -- example: ['CA', 'KS']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njob level greater than 200 refers to job_lvl>200; job description refers to job_desc\nAmong all employees, who have job level greater than 200. State the employee name and job description.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n state text, -- example: ['MA', 'DC']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_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 title refers to title under business where type = 'business'\nName all the authors for all business titles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.type = 'business'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T3.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.type = 'business'",
"index": 97,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n royalty integer, -- example: [10, 24]\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n state text, -- example: ['MA', 'DC']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_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 title refers to title under business where type = 'business'\nName all the authors for all business titles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_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 to date sales refers to ytd_sales; not on contract refers to contract = 0\nList all the titles and year to date sales by author who are not on contract.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] |
nl2sql
|
{
"ground_truth": "SELECT T1.title_id, T1.ytd_sales FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T3.contract = 0",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T1.title_id, T1.ytd_sales FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T3.contract = 0",
"index": 98,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: [\"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n pub_id text, -- publisher id, example: ['1389', '0736']\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n max_lvl integer, -- max level, example: [10, 250]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE discounts (\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n ord_date datetime, -- order date, example: ['1994-09-14 00:00:00.0', '1994-09-13 00:00:00.0']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n zip text, -- example: ['94025', '94618']\n contract text, -- example: ['0']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_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 to date sales refers to ytd_sales; not on contract refers to contract = 0\nList all the titles and year to date sales by author who are not on contract.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
nl2sql
|
[
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: ['Sushi, Anyone?', \"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost year to date sales refers to MAX(ytd_sales); on contract refers to contract = 1; name of author = au_fname, au_lname\nName all the authors for 'Sushi, Anyone?'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.title = 'Sushi, Anyone?'",
"style": "rule"
}
|
{
"db_id": "book_publishing_company.sqlite",
"gt_sql": "SELECT T3.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.title = 'Sushi, Anyone?'",
"index": 99,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE authors (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n au_lname text, -- author last name, example: ['White', 'Green']\n au_fname text, -- author first name, example: ['Johnson', 'Marjorie']\n phone text, -- example: ['408 496-7223', '415 986-7020']\n address text, -- example: ['10932 Bigge Rd.', '309 63rd St. #411']\n city text, -- example: ['Menlo Park', 'Oakland']\n state text, -- example: ['CA', 'KS']\n zip text, -- example: ['94025', '94618']\n PRIMARY KEY (au_id)\n);\n\nCREATE TABLE stores (\n stor_id text, -- store id, example: ['6380', '7066']\n stor_name text, -- store name, example: ['Eric the Read Books', \"Barnum's\"]\n stor_address text, -- store address, example: ['788 Catamaugus Ave.', '567 Pasadena Ave.']\n city text, -- example: ['Seattle', 'Tustin']\n state text, -- example: ['WA', 'CA']\n zip text, -- example: ['98056', '92789']\n PRIMARY KEY (stor_id)\n);\n\nCREATE TABLE pub_info (\n pub_id text, -- publication id, example: ['0877', '1389']\n logo blob, -- example: ['0x4749463839618B002F00B30F00000000800000', '0x474946383961C2001D00B30F00000000800000']\n pr_info text, -- publisher's information, example: ['This is sample text data for Binnet & Ha', 'This is sample text data for Algodata In']\n PRIMARY KEY (pub_id),\n CONSTRAINT fk_pub_info_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE publishers (\n pub_id text, -- publisher id, example: ['0736', '0877']\n pub_name text, -- publisher name, example: ['New Moon Books', 'Binnet & Hardley']\n city text, -- example: ['Boston', 'Washington']\n country text, -- example: ['USA', 'Germany']\n PRIMARY KEY (pub_id)\n);\n\nCREATE TABLE roysched (\n title_id text, -- example: ['BU1032', 'PC1035']\n lorange integer, -- low range, example: [0, 5001]\n hirange integer, -- high range, example: [5000, 50000]\n royalty integer, -- example: [10, 12]\n CONSTRAINT fk_roysched_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titleauthor (\n au_id text, -- author id, example: ['172-32-1176', '213-46-8915']\n title_id text, -- example: ['PS3333', 'BU1032']\n au_ord integer, -- author ordering, example: [1, 2]\n royaltyper integer, -- example: [100, 40]\n PRIMARY KEY (au_id, title_id),\n CONSTRAINT fk_titleauthor_au_id FOREIGN KEY (au_id) REFERENCES authors (au_id),\n CONSTRAINT fk_titleauthor_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE discounts (\n discounttype text, -- example: ['Initial Customer', 'Volume Discount']\n stor_id text, -- store id, example: ['8042']\n lowqty integer, -- low quantity, example: [100]\n highqty integer, -- high quantity, example: [1000]\n discount real, -- example: [10.5, 6.7]\n CONSTRAINT fk_discounts_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id)\n);\n\nCREATE TABLE jobs (\n job_id integer, -- example: [1, 2]\n job_desc text, -- job description, example: ['New Hire - Job not specified', 'Chief Executive Officer']\n min_lvl integer, -- min level, example: [10, 200]\n PRIMARY KEY (job_id)\n);\n\nCREATE TABLE employee (\n emp_id text, -- employee id, example: ['A-C71970F', 'A-R89858F']\n fname text, -- first name, example: ['Aria', 'Annette']\n minit text, -- example: ['M', 'R']\n lname text, -- last name, example: ['Cruz', 'Roulet']\n job_id integer, -- example: [10, 6]\n job_lvl integer, -- job level, example: [87, 152]\n pub_id text, -- publisher id, example: ['1389', '9999']\n PRIMARY KEY (emp_id),\n CONSTRAINT fk_employee_job_id FOREIGN KEY (job_id) REFERENCES jobs (job_id),\n CONSTRAINT fk_employee_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\n\nCREATE TABLE sales (\n stor_id text, -- store id, example: ['6380', '7066']\n ord_num text, -- order number, example: ['6871', '722a']\n qty integer, -- quantity, example: [5, 3]\n payterms text, -- example: ['Net 60', 'Net 30']\n title_id text, -- example: ['BU1032', 'PS2091']\n PRIMARY KEY (stor_id, ord_num, title_id),\n CONSTRAINT fk_sales_stor_id FOREIGN KEY (stor_id) REFERENCES stores (stor_id),\n CONSTRAINT fk_sales_title_id FOREIGN KEY (title_id) REFERENCES titles (title_id)\n);\n\nCREATE TABLE titles (\n title_id text, -- example: ['BU1032', 'BU1111']\n title text, -- example: ['Sushi, Anyone?', \"The Busy Executive's Database Guide\", 'Cooking with Computers: Surreptitious Ba']\n type text, -- example: ['business', 'mod_cook']\n pub_id text, -- publisher id, example: ['1389', '0736']\n price real, -- example: [19.99, 11.95]\n advance real, -- example: [5000.0, 10125.0]\n royalty integer, -- example: [10, 24]\n ytd_sales integer, -- year to date sales, example: [4095, 3876]\n notes text, -- example: ['An overview of available database system', 'Helpful hints on how to use your electro']\n pubdate datetime, -- publication date, example: ['1991-06-12 00:00:00.0', '1991-06-09 00:00:00.0']\n PRIMARY KEY (title_id),\n CONSTRAINT fk_titles_pub_id FOREIGN KEY (pub_id) REFERENCES publishers (pub_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost year to date sales refers to MAX(ytd_sales); on contract refers to contract = 1; name of author = au_fname, au_lname\nName all the authors for 'Sushi, Anyone?'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.