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 film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_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 2 special features refers to Count(special_features) > 2\nPlease list the titles of all the films that have more than 2 special features.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM ( SELECT title, COUNT(special_features) AS num FROM film GROUP BY title ) AS T ORDER BY T.num > 2",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT title FROM ( SELECT title, COUNT(special_features) AS num FROM film GROUP BY title ) AS T ORDER BY T.num > 2",
"index": 4300,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_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 2 special features refers to Count(special_features) > 2\nPlease list the titles of all the films that have more than 2 special features.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['JON', 'PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Jon', 'Mike']\n last_name text, -- example: ['Stephens', 'Hillyer']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['STEPHEN', 'JON', 'MARY', 'PATRICIA']\n last_name text, -- example: ['STEPHENS', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the email address of the staff Jon Stephens?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT email FROM staff WHERE first_name = 'Jon' AND last_name = 'Stephens'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT email FROM staff WHERE first_name = 'Jon' AND last_name = 'Stephens'",
"index": 4301,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['JON', 'PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Jon', 'Mike']\n last_name text, -- example: ['Stephens', 'Hillyer']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['STEPHEN', 'JON', 'MARY', 'PATRICIA']\n last_name text, -- example: ['STEPHENS', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is the email address of the staff Jon Stephens?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n rental_rate real, -- example: [0.99, 4.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_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\"English\" is the name of language\nHow many films are in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English'",
"index": 4302,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n rental_rate real, -- example: [0.99, 4.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_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\"English\" is the name of language\nHow many films are in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ACADEMY DINOSAUR\" is the title of film\nHow many actors have starred in the film ACADEMY DINOSAUR?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.actor_id) FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id WHERE T2.title = 'ACADEMY DINOSAUR'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.actor_id) FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id WHERE T2.title = 'ACADEMY DINOSAUR'",
"index": 4303,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"ACADEMY DINOSAUR\" is the title of film\nHow many actors have starred in the film ACADEMY DINOSAUR?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"English\" is the name of language\nAmong the films starring PENELOPE GUINESS, how many of them are in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T3.film_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN language AS T4 ON T3.language_id = T4.language_id WHERE T4.name = 'English' AND T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T3.film_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN language AS T4 ON T3.language_id = T4.language_id WHERE T4.name = 'English' AND T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'",
"index": 4304,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"English\" is the name of language\nAmong the films starring PENELOPE GUINESS, how many of them are in English?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_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\"Horror\" is the name of category\nPlease list the titles of all the films in the category of \"Horror\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror'",
"index": 4305,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_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\"Horror\" is the name of category\nPlease list the titles of all the films in the category of \"Horror\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_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\"Horror\" is the name of category; rental rate of $2.99 refers to rental_rate = 2.99\nPlease list the titles of all the films under the category of \"Horror\" and has a rental rate of $2.99.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror' AND T1.rental_rate = 2.99",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror' AND T1.rental_rate = 2.99",
"index": 4306,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_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\"Horror\" is the name of category; rental rate of $2.99 refers to rental_rate = 2.99\nPlease list the titles of all the films under the category of \"Horror\" and has a rental rate of $2.99.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUTH', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntimes of rented refers to Count(rental_id)\nFor how many times has the customer RUTH MARTINEZ rented a film?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ'",
"index": 4307,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUTH', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntimes of rented refers to Count(rental_id)\nFor how many times has the customer RUTH MARTINEZ rented a film?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['RUTH', 'MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest replacement cost refers to Max(replacement_cost)\nAmong the films that the customer RUTH MARTINEZ has rented, what is the title of the one with the highest replacement cost?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' ORDER BY T4.replacement_cost DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' ORDER BY T4.replacement_cost DESC LIMIT 1",
"index": 4308,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['RUTH', 'MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest replacement cost refers to Max(replacement_cost)\nAmong the films that the customer RUTH MARTINEZ has rented, what is the title of the one with the highest replacement cost?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUTH', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreturned in August, 2005 refers to year(return_date) = 2005 and month (return_date) = 8\nHow many films rented to the customer RUTH MARTINEZ were returned in August, 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' AND STRFTIME('%m',T2.return_date) = '8' AND STRFTIME('%Y', T2.return_date) = '2005'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' AND STRFTIME('%m',T2.return_date) = '8' AND STRFTIME('%Y', T2.return_date) = '2005'",
"index": 4309,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUTH', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreturned in August, 2005 refers to year(return_date) = 2005 and month (return_date) = 8\nHow many films rented to the customer RUTH MARTINEZ were returned in August, 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id))\nPlease give the full name of the customer that have rented the most 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 T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.rental_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.rental_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4310,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id))\nPlease give the full name of the customer that have rented the most 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 city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_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\"ACADEMY DINOSAUR\" is the title of film; customer refers to customer_id; active refers to active = 1\nAmong the customers who have rented the film ACADEMY DINOSAUR, how many of them are active?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.active = 1 AND T4.title = 'ACADEMY DINOSAUR'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.active = 1 AND T4.title = 'ACADEMY DINOSAUR'",
"index": 4311,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_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\"ACADEMY DINOSAUR\" is the title of film; customer refers to customer_id; active refers to active = 1\nAmong the customers who have rented the film ACADEMY DINOSAUR, how many of them are active?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_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 refers to title; film rented the most times refers to title where Max(Count(rental_id))\nWhich film is rented for the most times by the customers? Please give its title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4312,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_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 refers to title; film rented the most times refers to title where Max(Count(rental_id))\nWhich film is rented for the most times by the customers? Please give its title.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['WILLIAM', 'LINDA', 'RUTH', 'MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['WILLIAMS', 'MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['WILLIAM', 'PENELOPE', 'NICK']\n last_name text, -- example: ['WILLIAMS', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented more movie Max(Count(customer_id)); \"RUTH MARTINEZ\" and \"LINDA WILLIAMS\" are both full name of customer\nWhich customer has rented more movies, RUTH MARTINEZ or LINDA WILLIAMS?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE (T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ') OR (T1.first_name = 'LINDA' AND T1.last_name = 'WILLIAMS') GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE (T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ') OR (T1.first_name = 'LINDA' AND T1.last_name = 'WILLIAMS') GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4313,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['WILLIAM', 'LINDA', 'RUTH', 'MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['WILLIAMS', 'MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['WILLIAM', 'PENELOPE', 'NICK']\n last_name text, -- example: ['WILLIAMS', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented more movie Max(Count(customer_id)); \"RUTH MARTINEZ\" and \"LINDA WILLIAMS\" are both full name of customer\nWhich customer has rented more movies, RUTH MARTINEZ or LINDA WILLIAMS?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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\"Horror\" is the name of category; average replacement cost = Divide (Sum(replacement_cost), Count(film_id where name = Horror))\nWhat is the average replacement cost of the films under the category of \"Horror\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.replacement_cost) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.name = 'Horror'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT AVG(T3.replacement_cost) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.name = 'Horror'",
"index": 4314,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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\"Horror\" is the name of category; average replacement cost = Divide (Sum(replacement_cost), Count(film_id where name = Horror))\nWhat is the average replacement cost of the films under the category of \"Horror\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Music', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['RUTH', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmusic film refers to name = 'Music'; percentage = Divide (Count(film_id where name = 'Music'), Count(film_id)) * 100\nAmong all films that the customer RUTH MARTINEZ has rented, what is the percentage of it being a Music film?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T3.name = 'Music', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id INNER JOIN inventory AS T4 ON T1.film_id = T4.film_id INNER JOIN customer AS T5 ON T4.store_id = T5.store_id INNER JOIN rental AS T6 ON T4.inventory_id = T6.inventory_id WHERE T5.first_name = 'RUTH' AND T5.last_name = 'MARTINEZ'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T3.name = 'Music', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id INNER JOIN inventory AS T4 ON T1.film_id = T4.film_id INNER JOIN customer AS T5 ON T4.store_id = T5.store_id INNER JOIN rental AS T6 ON T4.inventory_id = T6.inventory_id WHERE T5.first_name = 'RUTH' AND T5.last_name = 'MARTINEZ'",
"index": 4315,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Music', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['RUTH', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MARTINEZ', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmusic film refers to name = 'Music'; percentage = Divide (Count(film_id where name = 'Music'), Count(film_id)) * 100\nAmong all films that the customer RUTH MARTINEZ has rented, what is the percentage of it being a Music film?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_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 duration time = AVG(length)\nWhat is the average duration time of the films starring PENELOPE GUINESS?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.length) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT AVG(T3.length) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'",
"index": 4316,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_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 duration time = AVG(length)\nWhat is the average duration time of the films starring PENELOPE GUINESS?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['DIANE', 'MARY', 'PATRICIA']\n last_name text, -- example: ['COLLINS', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is Diane Collins' email address?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS'",
"index": 4317,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['DIANE', 'MARY', 'PATRICIA']\n last_name text, -- example: ['COLLINS', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhat is Diane Collins' email address?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['JEREMY.HURTADO@sakilacustomer.org', 'MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_duration integer, -- example: [6, 3]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"JEREMY.HURTADO@sakilacustomer.org\" is the email; owner refers to customer; full name refers to first_name, last_name\nWho is the owner of email address \"JEREMY.HURTADO@sakilacustomer.org\"? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT first_name, last_name FROM customer WHERE email = 'JEREMY.HURTADO@sakilacustomer.org'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT first_name, last_name FROM customer WHERE email = 'JEREMY.HURTADO@sakilacustomer.org'",
"index": 4318,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['JEREMY.HURTADO@sakilacustomer.org', 'MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_duration integer, -- example: [6, 3]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"JEREMY.HURTADO@sakilacustomer.org\" is the email; owner refers to customer; full name refers to first_name, last_name\nWho is the owner of email address \"JEREMY.HURTADO@sakilacustomer.org\"? Give the full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddress no. 65 refers to address_id = 65\nGive the postal code for the address No.65.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT postal_code FROM address WHERE address_id = 65",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT postal_code FROM address WHERE address_id = 65",
"index": 4319,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddress no. 65 refers to address_id = 65\nGive the postal code for the address No.65.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Nordrhein-Westfalen', 'Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of address refers to address_id\nState the number of addresses in the Nordrhein-Westfalen district.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(address_id) FROM address WHERE district = 'Nordrhein-Westfalen'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(address_id) FROM address WHERE district = 'Nordrhein-Westfalen'",
"index": 4320,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Nordrhein-Westfalen', 'Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnumber of address refers to address_id\nState the number of addresses in the Nordrhein-Westfalen district.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n178 min long refers to length = '178'\nState the number of films that are 178 minutes long.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(film_id) FROM film WHERE length = '178'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(film_id) FROM film WHERE length = '178'",
"index": 4321,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n178 min long refers to length = '178'\nState the number of films that are 178 minutes long.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UPRISING UPTOWN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UPRISING UPTOWN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_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\"UPRISING UPTOWN\" is the title of film\nTell the special features of the film Uprising Uptown.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT special_features FROM film WHERE title = 'UPRISING UPTOWN'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT special_features FROM film WHERE title = 'UPRISING UPTOWN'",
"index": 4322,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UPRISING UPTOWN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UPRISING UPTOWN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_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\"UPRISING UPTOWN\" is the title of film\nTell the special features of the film Uprising Uptown.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_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 no. 22 refers to store_id = 2; detailed address refers to address, address2, district\nGive the detailed address for store No.2.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2",
"index": 4323,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_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 no. 22 refers to store_id = 2; detailed address refers to address, address2, district\nGive the detailed address for store No.2.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Clarksville', 'A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n original_language_id integer,\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_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\"Clarksville\" is the city;\nWhich continent is the mother country of Clarksville city in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Clarksville'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Clarksville'",
"index": 4324,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Clarksville', 'A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n original_language_id integer,\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_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\"Clarksville\" is the city;\nWhich continent is the mother country of Clarksville city in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['DARYL', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['DARYL', 'PENELOPE', 'NICK']\n last_name text, -- example: ['WAHLBERG', 'GUINESS']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many films did actor Daryl Wahlberg appear in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'DARYL' AND T2.last_name = 'WAHLBERG'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'DARYL' AND T2.last_name = 'WAHLBERG'",
"index": 4325,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['DARYL', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['DARYL', 'PENELOPE', 'NICK']\n last_name text, -- example: ['WAHLBERG', 'GUINESS']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many films did actor Daryl Wahlberg appear in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_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 no. 1 refers to store_id = 1; name refers to first_name, last_name\nGive the name of the manager staff for store No.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 T1.first_name, T1.last_name FROM staff AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T2.store_id = 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM staff AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T2.store_id = 1",
"index": 4326,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_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 no. 1 refers to store_id = 1; name refers to first_name, last_name\nGive the name of the manager staff for store No.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 city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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 no. 1 refers to store_id = 1; address location refers to address, address2, district\nState the address location of store No.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 T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 1",
"index": 4327,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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 no. 1 refers to store_id = 1; address location refers to address, address2, district\nState the address location of store No.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 film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Woodridge', 'A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_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\"Woodridge\" is the city\nHow many addresses are there in Woodridge city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.address_id) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = 'Woodridge'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.address_id) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = 'Woodridge'",
"index": 4328,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Woodridge', 'A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_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\"Woodridge\" is the city\nHow many addresses are there in Woodridge city?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['HEATHER', 'MORRIS', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MORRIS', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddress location refers to address\nGive the address location of Heather Morris.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'HEATHER' AND T2.last_name = 'MORRIS'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'HEATHER' AND T2.last_name = 'MORRIS'",
"index": 4329,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['HEATHER', 'MORRIS', 'MARY', 'PATRICIA']\n last_name text, -- example: ['MORRIS', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddress location refers to address\nGive the address location of Heather Morris.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['1411 Lillydale Drive', '47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_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\"1411 Lillydate Drive\" is the address\nGive the email address of the person who lives in \"1411 Lillydale Drive\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.email FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '1411 Lillydale Drive'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.email FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '1411 Lillydale Drive'",
"index": 4330,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['1411 Lillydale Drive', '47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_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\"1411 Lillydate Drive\" is the address\nGive the email address of the person who lives in \"1411 Lillydale Drive\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_duration integer, -- example: [6, 3]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-07-28 12:27:27.0', '2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer no. 297 refers to customer_id = 297; at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27'; money pay for rent refers to amount\nHow much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.amount FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id WHERE T2.rental_date = '2005-07-28 12:27:27' AND T2.customer_id = 297",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.amount FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id WHERE T2.rental_date = '2005-07-28 12:27:27' AND T2.customer_id = 297",
"index": 4331,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_duration integer, -- example: [6, 3]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-07-28 12:27:27.0', '2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer no. 297 refers to customer_id = 297; at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27'; money pay for rent refers to amount\nHow much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninventory no. 3479 refers to inventory_id = '3479'; name of film refers to title\nGive the name of the film for inventory No.3479.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id = 3479",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id = 3479",
"index": 4332,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninventory no. 3479 refers to inventory_id = '3479'; name of film refers to title\nGive the name of the film for inventory No.3479.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['R', 'PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestricted refers to rating = 'R'; release refers to release_year; in 2006 refers to release_year = 2006; film refers to title\nIn 2006, how many restricted films 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 COUNT(film_id) FROM film WHERE rating = 'R' AND release_year = 2006",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(film_id) FROM film WHERE rating = 'R' AND release_year = 2006",
"index": 4333,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['R', 'PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestricted refers to rating = 'R'; release refers to release_year; in 2006 refers to release_year = 2006; film refers to title\nIn 2006, how many restricted films 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 store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many actors starred in the film id 508?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(actor_id) FROM film_actor WHERE film_id = 508",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(actor_id) FROM film_actor WHERE film_id = 508",
"index": 4334,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many actors starred in the film id 508?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive employee refers to active = 1; full name refers to first_name, last_name\nWhat are the full names of all the active 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 first_name, last_name FROM staff WHERE active = 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT first_name, last_name FROM staff WHERE active = 1",
"index": 4335,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive employee refers to active = 1; full name refers to first_name, last_name\nWhat are the full names of all the active 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 staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstaff manager refers to manager_staff_id\nWho is the staff manager in store id 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 manager_staff_id FROM store WHERE store_id = 2",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT manager_staff_id FROM store WHERE store_id = 2",
"index": 4336,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nstaff manager refers to manager_staff_id\nWho is the staff manager in store id 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 film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_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 of film refers to title\nList the name of the films that can only be found in store id 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 T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2",
"index": 4337,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_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 of film refers to title\nList the name of the films that can only be found in store id 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 customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['DAY', 'SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented for 7 consecutive days refers to Subtract(return_date, rental_date) = 7; full name refers to first_name, last_name\nWhat is the full name of the customer who rented movies for 7 consecutive days?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN ( SELECT customer_id, COUNT(*) AS num_days FROM ( SELECT *, date(days, '-' || rn || ' day') AS results FROM ( SELECT customer_id, days, row_number() OVER (PARTITION BY customer_id ORDER BY days) AS rn FROM ( SELECT DISTINCT customer_id, date(rental_date) AS days FROM rental ) ) ) GROUP BY customer_id, results HAVING num_days = 7 ) AS T2 ON T1.customer_id = T2.customer_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN ( SELECT customer_id, COUNT(*) AS num_days FROM ( SELECT *, date(days, '-' || rn || ' day') AS results FROM ( SELECT customer_id, days, row_number() OVER (PARTITION BY customer_id ORDER BY days) AS rn FROM ( SELECT DISTINCT customer_id, date(rental_date) AS days FROM rental ) ) ) GROUP BY customer_id, results HAVING num_days = 7 ) AS T2 ON T1.customer_id = T2.customer_id",
"index": 4338,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['DAY', 'SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented for 7 consecutive days refers to Subtract(return_date, rental_date) = 7; full name refers to first_name, last_name\nWhat is the full name of the customer who rented movies for 7 consecutive days?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_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\"Horror\" is the name of category\nHow many films are categorized as horror?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'",
"index": 4339,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_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\"Horror\" is the name of category\nHow many films are categorized as horror?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_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\"science fiction\" is the name of category; most common special features refers to Max(frequency(special_features))\nWhat is the most common special features of science-fiction movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.special_features FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'sci-fi' ORDER BY T1.special_features DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.special_features FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'sci-fi' ORDER BY T1.special_features DESC LIMIT 1",
"index": 4340,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_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\"science fiction\" is the name of category; most common special features refers to Max(frequency(special_features))\nWhat is the most common special features of science-fiction movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Comedy', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrental duration of 7 refers to rental_duration = 7; comedies refers to name = 'Comedy'\nAmong the films with a rental duration of 7 days, how many are comedies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration = 7 AND T3.name = 'Comedy'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration = 7 AND T3.name = 'Comedy'",
"index": 4341,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Comedy', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrental duration of 7 refers to rental_duration = 7; comedies refers to name = 'Comedy'\nAmong the films with a rental duration of 7 days, how many are comedies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_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 non-active customer refers to Max(Count(active = 0))\nWho is the staff manager of the store with the most non-active customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.store_id = T3.store_id WHERE T1.active = 0 GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.store_id = T3.store_id WHERE T1.active = 0 GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4342,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_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 non-active customer refers to Max(Count(active = 0))\nWho is the staff manager of the store with the most non-active customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id))\nWhat is the full name of the customer who rented the highest number of movies of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.rental_id) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.rental_id) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4343,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id))\nWhat is the full name of the customer who rented the highest number of movies of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLANKET BEVERLY', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLANKET BEVERLY', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_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\"BLANKET BEVERLY\" is the title of film; rented times refers to count(rental_id)\nHow many times was \"Blanket Beverly\" rented?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T3.rental_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.title = 'Blanket Beverly'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T3.rental_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.title = 'Blanket Beverly'",
"index": 4344,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLANKET BEVERLY', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLANKET BEVERLY', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_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\"BLANKET BEVERLY\" is the title of film; rented times refers to count(rental_id)\nHow many times was \"Blanket Beverly\" rented?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['G', 'PG']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_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 replacement cost refers to Min(replacement_cost); under general audience rating refers to rating = G\nList down the films titles with the lowest replacement cost under the general audiences rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM film WHERE replacement_cost = ( SELECT MIN(replacement_cost) FROM film )",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT title FROM film WHERE replacement_cost = ( SELECT MIN(replacement_cost) FROM film )",
"index": 4345,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['G', 'PG']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_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 replacement cost refers to Min(replacement_cost); under general audience rating refers to rating = G\nList down the films titles with the lowest replacement cost under the general audiences rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_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 duration of film refers to Max(length)\nAmong the films with the longest duration, list any five title with their descriptions and special features.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title, description, special_features FROM film WHERE length = ( SELECT MAX(length) FROM film ) LIMIT 5",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT title, description, special_features FROM film WHERE length = ( SELECT MAX(length) FROM film ) LIMIT 5",
"index": 4346,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_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 duration of film refers to Max(length)\nAmong the films with the longest duration, list any five title with their descriptions and special features.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented on 26th May 2005 refers to rental_date = '2005-05-26'; return on 30th May, 2005 refers to return_date = '2005-05-30'; number of rented film refers to Count (rental_id)\nHow many films rented on 26th May, 2005 were returned on 30th May, 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-30'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-30'",
"index": 4347,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented on 26th May 2005 refers to rental_date = '2005-05-26'; return on 30th May, 2005 refers to return_date = '2005-05-30'; number of rented film refers to Count (rental_id)\nHow many films rented on 26th May, 2005 were returned on 30th May, 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_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 refers to first_name, last_name\nWhat is the name and email of the staff in store ID 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 first_name, last_name, email FROM staff WHERE store_id = 2",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT first_name, last_name, email FROM staff WHERE store_id = 2",
"index": 4348,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_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 refers to first_name, last_name\nWhat is the name and email of the staff in store ID 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 actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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 August 2005 refers to payment_date like '2005-08%'; total payment amount refers to Sum(amount)\nCalculate customers' total payment amount in August, 2005.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'",
"index": 4349,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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 August 2005 refers to payment_date like '2005-08%'; total payment amount refers to Sum(amount)\nCalculate customers' total payment amount in August, 2005.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CHOCOLATE DUCK', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CHOCOLATE DUCK', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_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\"CHOCOLATE DUCK\" is the title of film; full name refers to first_name, last_name\nList down the actors' full names who performed in \"CHOCOLATE DUCK\" film.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T3.last_name FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = 'CHOCOLATE DUCK'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T3.first_name, T3.last_name FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = 'CHOCOLATE DUCK'",
"index": 4350,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CHOCOLATE DUCK', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CHOCOLATE DUCK', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_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\"CHOCOLATE DUCK\" is the title of film; full name refers to first_name, last_name\nList down the actors' full names who performed in \"CHOCOLATE DUCK\" film.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Documentary', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_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\"Documentary\" is the name of category; film name refers to title\nWrite down any five film names under the documentary category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Documentary' LIMIT 5",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Documentary' LIMIT 5",
"index": 4351,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Documentary', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_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\"Documentary\" is the name of category; film name refers to title\nWrite down any five film names under the documentary category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UNTOUCHABLES SUNRISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UNTOUCHABLES SUNRISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"UNTOUCHABLES SUNRISE\" is the title of film; language refers to name; rental cost per day = Divide (rental_cost, rental_duration)\nMention the language of Untouchables Sunrise film and calculate its rental cost per day.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.name, T1.replacement_cost / T1.rental_duration AS cost FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'UNTOUCHABLES SUNRISE'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.name, T1.replacement_cost / T1.rental_duration AS cost FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'UNTOUCHABLES SUNRISE'",
"index": 4352,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UNTOUCHABLES SUNRISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['UNTOUCHABLES SUNRISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"UNTOUCHABLES SUNRISE\" is the title of film; language refers to name; rental cost per day = Divide (rental_cost, rental_duration)\nMention the language of Untouchables Sunrise film and calculate its rental cost per day.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['DREAM PICKUP', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['DREAM PICKUP', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; 'DREAM PICKUP' is a title of film\nDescribe the full names and cities of the customers who rented \"DREAM PICKUP\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.first_name, T4.last_name, T6.city FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN customer AS T4 ON T3.customer_id = T4.customer_id INNER JOIN address AS T5 ON T4.address_id = T5.address_id INNER JOIN city AS T6 ON T5.city_id = T6.city_id WHERE T1.title = 'DREAM PICKUP'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T4.first_name, T4.last_name, T6.city FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN customer AS T4 ON T3.customer_id = T4.customer_id INNER JOIN address AS T5 ON T4.address_id = T5.address_id INNER JOIN city AS T6 ON T5.city_id = T6.city_id WHERE T1.title = 'DREAM PICKUP'",
"index": 4353,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['DREAM PICKUP', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['DREAM PICKUP', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; 'DREAM PICKUP' is a title of film\nDescribe the full names and cities of the customers who rented \"DREAM PICKUP\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['India', 'Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_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'India' is a country; calculation = DIVIDE(SUM(country = 'India'), COUNT(customer_id)) * 100\nCalculate how many percent of customers were located in India.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) * 100 / COUNT(T4.customer_id) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) * 100 / COUNT(T4.customer_id) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id",
"index": 4354,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['India', 'Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_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'India' is a country; calculation = DIVIDE(SUM(country = 'India'), COUNT(customer_id)) * 100\nCalculate how many percent of customers were located in India.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['ANGELA', 'MARY', 'PENELOPE', 'NICK']\n last_name text, -- example: ['WITHERSPOON', 'KEITEL', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['ANGELA', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_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'Mary Keitel' AND 'Angela Witherspoon' are full name of actors; full name refers to FirstName, LastName; calculation = DIVIDE(SUBTRACT(SUM('Mary Keitel'), SUM('Angela Witherspoon')), SUM('Angela Witherspoon')) * 100\nHow much percentage of the film did Mary Keitel perform more than Angela Witherspoon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST((SUM(IIF(T1.first_name = 'ANGELA' AND T1.last_name = 'WITHERSPOON', 1, 0)) - SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0))) AS REAL) * 100 / SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0)) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST((SUM(IIF(T1.first_name = 'ANGELA' AND T1.last_name = 'WITHERSPOON', 1, 0)) - SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0))) AS REAL) * 100 / SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0)) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id",
"index": 4355,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['ANGELA', 'MARY', 'PENELOPE', 'NICK']\n last_name text, -- example: ['WITHERSPOON', 'KEITEL', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['ANGELA', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_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'Mary Keitel' AND 'Angela Witherspoon' are full name of actors; full name refers to FirstName, LastName; calculation = DIVIDE(SUBTRACT(SUM('Mary Keitel'), SUM('Angela Witherspoon')), SUM('Angela Witherspoon')) * 100\nHow much percentage of the film did Mary Keitel perform more than Angela Witherspoon?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['DIANE', 'MARY', 'PATRICIA']\n last_name text, -- example: ['COLLINS', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_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'Diane Collins' is a full name of a customer; full name refers to first_name, last_name\nCalculate the total payment amount by Diane Collins.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Diane' AND T1.last_name = 'Collins'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT SUM(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Diane' AND T1.last_name = 'Collins'",
"index": 4356,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['DIANE', 'MARY', 'PATRICIA']\n last_name text, -- example: ['COLLINS', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_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'Diane Collins' is a full name of a customer; full name refers to first_name, last_name\nCalculate the total payment amount by Diane Collins.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many films have a rental rate of 0.99?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(film_id) FROM film WHERE rental_rate = 0.99",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(film_id) FROM film WHERE rental_rate = 0.99",
"index": 4357,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow many films have a rental rate of 0.99?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['THOMAS', 'MARY', 'PATRICIA']\n last_name text, -- example: ['THOMAS', 'SMITH', 'JOHNSON']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer ID of 100 and below refers to customer_id < 100\nAmong the customers with customer ID of 100 and below, how many of them have Thomas as their last name?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(customer_id) FROM customer WHERE last_name = 'Thomas' AND customer_id < 100",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(customer_id) FROM customer WHERE last_name = 'Thomas' AND customer_id < 100",
"index": 4358,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['THOMAS', 'MARY', 'PATRICIA']\n last_name text, -- example: ['THOMAS', 'SMITH', 'JOHNSON']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncustomer ID of 100 and below refers to customer_id < 100\nAmong the customers with customer ID of 100 and below, how many of them have Thomas as their last 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 inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['LIZA', 'PENELOPE', 'NICK']\n last_name text, -- example: ['BERGMAN', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLiza Bergman' is a full name; full name refers to first_name, last_name; highest replacement cost refers to MAX(replacement_cost)\nGive the title of the film starred by Liza Bergman with the highest replacement cost.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Liza' AND T1.last_name = 'Bergman' ORDER BY replacement_cost DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Liza' AND T1.last_name = 'Bergman' ORDER BY replacement_cost DESC LIMIT 1",
"index": 4359,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['LIZA', 'PENELOPE', 'NICK']\n last_name text, -- example: ['BERGMAN', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nLiza Bergman' is a full name; full name refers to first_name, last_name; highest replacement cost refers to MAX(replacement_cost)\nGive the title of the film starred by Liza Bergman with the highest replacement cost.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_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 rental rate refers to MAX(rental_rate)\nAmong films with store ID of 2, list the title of films with the highest rental rate.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 ORDER BY rental_rate DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 ORDER BY rental_rate DESC LIMIT 1",
"index": 4360,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_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 rental rate refers to MAX(rental_rate)\nAmong films with store ID of 2, list the title of films with the highest rental rate.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AFRICAN EGG', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AFRICAN EGG', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_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'African Egg' is a title of a film\nList the inventory ID of the film titled \"African Egg\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'African Egg'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'African Egg'",
"index": 4361,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AFRICAN EGG', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AFRICAN EGG', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_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'African Egg' is a title of a film\nList the inventory ID of the film titled \"African Egg\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['KIRK', 'PENELOPE', 'NICK']\n last_name text, -- example: ['JOVOVICH', 'GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['KIRK', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlength duration of 113 minutes refers to length = 113; 'Kirk Jovovich' is a full name of an actor; full name refers to first_name, last_name\nIn films with a length duration of 113 minutes, how many of the films are starred by Kirk Jovovich?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length = 113 AND T1.first_name = 'Kirk' AND T1.last_name = 'Jovovich'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length = 113 AND T1.first_name = 'Kirk' AND T1.last_name = 'Jovovich'",
"index": 4362,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['KIRK', 'PENELOPE', 'NICK']\n last_name text, -- example: ['JOVOVICH', 'GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['KIRK', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlength duration of 113 minutes refers to length = 113; 'Kirk Jovovich' is a full name of an actor; full name refers to first_name, last_name\nIn films with a length duration of 113 minutes, how many of the films are starred by Kirk Jovovich?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUSSELL', 'MARY', 'PATRICIA']\n last_name text, -- example: ['RUSSELL', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUSSELL', 'PENELOPE', 'NICK']\n last_name text, -- example: ['CLOSE', 'GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_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'Russell Close' is a full name of an actor; full name refers to first_name, last_name; duration between 110 to 150 minutes refers to length BETWEEN 110 AND 150\nWhat is the inventory ID of the films starred by Russell Close with a duration between 110 to 150 minutes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T4.inventory_id FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.last_name = 'Close'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T4.inventory_id FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.last_name = 'Close'",
"index": 4363,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUSSELL', 'MARY', 'PATRICIA']\n last_name text, -- example: ['RUSSELL', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['RUSSELL', 'PENELOPE', 'NICK']\n last_name text, -- example: ['CLOSE', 'GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_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'Russell Close' is a full name of an actor; full name refers to first_name, last_name; duration between 110 to 150 minutes refers to length BETWEEN 110 AND 150\nWhat is the inventory ID of the films starred by Russell Close with a duration between 110 to 150 minutes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_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 longest duration refers to MAX(length)\nWhat is the store and inventory ID of the film with the longest duration?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1",
"index": 4364,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_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 longest duration refers to MAX(length)\nWhat is the store and inventory ID of the film with the longest duration?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_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 rental rate of all listed films refers to AVG(rental_rate); rental rate greater than the 60% of average rental rate refers to rental_rate > (AVG(rental_rate)) MULTIPLY 0.6\nList the store ID of the films with a rental rate greater than the 60% of average rental rate of all listed 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.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 )",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 )",
"index": 4365,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n PRIMARY KEY (customer_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 rental rate of all listed films refers to AVG(rental_rate); rental rate greater than the 60% of average rental rate refers to rental_rate > (AVG(rental_rate)) MULTIPLY 0.6\nList the store ID of the films with a rental rate greater than the 60% of average rental rate of all listed 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 category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Texas', 'Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_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'Texas' is a district\nList the address in Texas in the ascending order of city 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 address FROM address WHERE district = 'Texas' AND city_id = ( SELECT MIN(city_id) FROM address WHERE district = 'Texas' )",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT address FROM address WHERE district = 'Texas' AND city_id = ( SELECT MIN(city_id) FROM address WHERE district = 'Texas' )",
"index": 4366,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Texas', 'Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_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'Texas' is a district\nList the address in Texas in the ascending order of city 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 `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; record created in 2006 refers to create_date = 2006; inactive customers refers to active = 0\nFind the full name and email address of inactive customers whose record was created in 2006.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT first_name, last_name, email FROM customer WHERE STRFTIME('%Y',create_date) = '2006' AND active = 0",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT first_name, last_name, email FROM customer WHERE STRFTIME('%Y',create_date) = '2006' AND active = 0",
"index": 4367,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; record created in 2006 refers to create_date = 2006; inactive customers refers to active = 0\nFind the full name and email address of inactive customers whose record was created in 2006.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG-13', 'PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPG-13 is a rating; calculation = DIVIDE(SUM(rating = PG-13), SUM(rating)) * 100\nWhat percentage of the movies are PG-13?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(rating = 'PG-13', 1, 0)) AS REAL) * 100 / COUNT(film_id) FROM film",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(rating = 'PG-13', 1, 0)) AS REAL) * 100 / COUNT(film_id) FROM film",
"index": 4368,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG-13', 'PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPG-13 is a rating; calculation = DIVIDE(SUM(rating = PG-13), SUM(rating)) * 100\nWhat percentage of the movies are PG-13?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovies with the most price per day refers to MAX(rental_rate)\nPlease list the top ten movies with the most price per day in descending order of price per day.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 10",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 10",
"index": 4369,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmovies with the most price per day refers to MAX(rental_rate)\nPlease list the top ten movies with the most price per day in descending order of price per day.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_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 rent amount refers to AVG(amount)\nCalculate the average rent amount paid by the customer with customer id 15.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(amount) FROM payment WHERE customer_id = 15",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT AVG(amount) FROM payment WHERE customer_id = 15",
"index": 4370,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_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 rent amount refers to AVG(amount)\nCalculate the average rent amount paid by the customer with customer id 15.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented period refers to SUBTRACT(return_date, rental_date); calculation = rented period > (AVG(rented period))\nHow many customers rented for an above-average period?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(customer_id) FROM rental WHERE return_date - rental_date > ( SELECT AVG(return_date - rental_date) FROM rental )",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(customer_id) FROM rental WHERE return_date - rental_date > ( SELECT AVG(return_date - rental_date) FROM rental )",
"index": 4371,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrented period refers to SUBTRACT(return_date, rental_date); calculation = rented period > (AVG(rented period))\nHow many customers rented for an above-average period?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n active integer, -- example: [1]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhorror is a name of film category; calculation = DIVIDE(COUNT('horror'), COUNT(category_id)) * 100\nAmong the movies, what percentage are horror?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T2.name = 'horror', 1, 0)) AS REAL) * 100 / COUNT(T2.category_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T2.name = 'horror', 1, 0)) AS REAL) * 100 / COUNT(T2.category_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id",
"index": 4372,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n active integer, -- example: [1]\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n address_id integer, -- example: [5, 6]\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhorror is a name of film category; calculation = DIVIDE(COUNT('horror'), COUNT(category_id)) * 100\nAmong the movies, what percentage are horror?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['DAY', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Australia', 'Canada', 'Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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'Australia' AND 'Canada' are country; average number of films refers to AVG('Australia') AND AVG('Canada'); calculation = SUBTRACT(AVG('Australia'), AVG('Canada'))\nWhat is the difference in the average number of films rented each day in Australia and Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(IIF(T4.country = 'Australia', 1, 0)) - AVG(IIF(T4.country = 'Canada', 1, 0)) AS diff FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT AVG(IIF(T4.country = 'Australia', 1, 0)) - AVG(IIF(T4.country = 'Canada', 1, 0)) AS diff FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id",
"index": 4373,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['DAY', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Australia', 'Canada', 'Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_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'Australia' AND 'Canada' are country; average number of films refers to AVG('Australia') AND AVG('Canada'); calculation = SUBTRACT(AVG('Australia'), AVG('Canada'))\nWhat is the difference in the average number of films rented each day in Australia and Canada?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['REESE', 'PENELOPE', 'NICK']\n last_name text, -- example: ['KILMER', 'GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_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'Reese Kilmer' is a full name of an actor; 'action' is the name of the category; calculation = DIVIDE(COUNT('action'), COUNT(category_id)) * 100\nOf the movies in which Reese Kilmer acted, what percentage are action movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.last_name = 'Kilmer'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.last_name = 'Kilmer'",
"index": 4374,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['REESE', 'PENELOPE', 'NICK']\n last_name text, -- example: ['KILMER', 'GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n length integer, -- example: [86, 48]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_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'Reese Kilmer' is a full name of an actor; 'action' is the name of the category; calculation = DIVIDE(COUNT('action'), COUNT(category_id)) * 100\nOf the movies in which Reese Kilmer acted, what percentage are action movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CLOCKWORK PARADISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CLOCKWORK PARADISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_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'Clockwork Paradice' is a title of a film\nGive the total amount of rent for the movie Clockwork Paradice.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'CLOCKWORK PARADICE'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'CLOCKWORK PARADICE'",
"index": 4375,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CLOCKWORK PARADISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['CLOCKWORK PARADISE', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_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'Clockwork Paradice' is a title of a film\nGive the total amount of rent for the movie Clockwork Paradice.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Sci-Fi', 'Family', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; 'family' AND 'Sci-Fi' are names of the category; customers who rented more family movies than Sci-Fi movies refers to count(name = 'Family') > count(name = 'Sci-Fi')\nFind and list the full name of customers who rented more family movies than Sci-Fi movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 IIF(SUM(IIF(T5.name = 'Family', 1, 0)) - SUM(IIF(T5.name = 'Sci-Fi', 1, 0)) > 0, T1.first_name, 0) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film_category AS T4 ON T4.film_id = T3.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id GROUP BY T1.customer_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT DISTINCT IIF(SUM(IIF(T5.name = 'Family', 1, 0)) - SUM(IIF(T5.name = 'Sci-Fi', 1, 0)) > 0, T1.first_name, 0) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film_category AS T4 ON T4.film_id = T3.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id GROUP BY T1.customer_id",
"index": 4376,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Sci-Fi', 'Family', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull name refers to first_name, last_name; 'family' AND 'Sci-Fi' are names of the category; customers who rented more family movies than Sci-Fi movies refers to count(name = 'Family') > count(name = 'Sci-Fi')\nFind and list the full name of customers who rented more family movies than Sci-Fi movies.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n original_language_id integer,\n rating text, -- example: ['NC-17', 'PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_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'Adults Only' refers to rating = 'NC-17'\nIndicate the title of all the films rated as 'Adults Only'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM film WHERE rating = 'NC-17'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT title FROM film WHERE rating = 'NC-17'",
"index": 4377,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n original_language_id integer,\n rating text, -- example: ['NC-17', 'PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_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'Adults Only' refers to rating = 'NC-17'\nIndicate the title of all the films rated as 'Adults Only'.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Classics', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_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'classics' is the name of category\nIndicate the title of all the films that are in the Classics category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.title FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id WHERE T3.name = 'Classics'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.title FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id WHERE T3.name = 'Classics'",
"index": 4378,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Classics', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_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'classics' is the name of category\nIndicate the title of all the films that are in the Classics category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Jon', 'Mike']\n last_name text, -- example: ['Stephens', 'Hillyer']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['STEPHEN', 'JON', 'MARY', 'PATRICIA']\n last_name text, -- example: ['STEPHENS', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['JON', 'PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_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'Jon Stephens' is a full name of a customer; full name refers to first_name, last_name;\nHow many different clients have rented materials from Jon Stephens?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'",
"index": 4379,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Jon', 'Mike']\n last_name text, -- example: ['Stephens', 'Hillyer']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['STEPHEN', 'JON', 'MARY', 'PATRICIA']\n last_name text, -- example: ['STEPHENS', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['JON', 'PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_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'Jon Stephens' is a full name of a customer; full name refers to first_name, last_name;\nHow many different clients have rented materials from Jon Stephens?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJuly 29, 2005 refers to rental_date like '2005-07-29'\nWhat is the total amount paid for rentals made on July 29, 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.amount) FROM rental AS T1 INNER JOIN payment AS T2 ON T1.rental_id = T2.rental_id WHERE date(T1.rental_date) = '2005-07-29%'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT SUM(T2.amount) FROM rental AS T1 INNER JOIN payment AS T2 ON T1.rental_id = T2.rental_id WHERE date(T1.rental_date) = '2005-07-29%'",
"index": 4380,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nJuly 29, 2005 refers to rental_date like '2005-07-29'\nWhat is the total amount paid for rentals made on July 29, 2005?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n rental_duration integer, -- example: [6, 3]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal code that begins with 76 refers to postal_code like '76%'\nWhat is the first name of the customers whose address is in the postal code that begins with 76?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'",
"index": 4381,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n rental_duration integer, -- example: [6, 3]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npostal code that begins with 76 refers to postal_code like '76%'\nWhat is the first name of the customers whose address is in the postal code that begins with 76?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLOOD ARGONAUTS', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLOOD ARGONAUTS', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'BLOOD ARGONAUTS' is a title of a film; date a movie was returned refers to return_date\nOn what date was the rented material for the movie BLOOD ARGONAUTS returned?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.rental_date FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BLOOD ARGONAUTS'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.rental_date FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BLOOD ARGONAUTS'",
"index": 4382,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLOOD ARGONAUTS', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['BLOOD ARGONAUTS', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n'BLOOD ARGONAUTS' is a title of a film; date a movie was returned refers to return_date\nOn what date was the rented material for the movie BLOOD ARGONAUTS returned?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['CUBA', 'PENELOPE', 'NICK']\n last_name text, -- example: ['ALLEN', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['ALLEN', 'MARY', 'PATRICIA']\n last_name text, -- example: ['ALLEN', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_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'Cuba Allen' is a full name of an actor; full name refers to first_name, last_name\nWhat is the title of the films in which Cuba Allen acted?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Cuba' AND T1.last_name = 'Allen'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Cuba' AND T1.last_name = 'Allen'",
"index": 4383,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['CUBA', 'PENELOPE', 'NICK']\n last_name text, -- example: ['ALLEN', 'GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n length integer, -- example: [86, 48]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['ALLEN', 'MARY', 'PATRICIA']\n last_name text, -- example: ['ALLEN', 'SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_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'Cuba Allen' is a full name of an actor; full name refers to first_name, last_name\nWhat is the title of the films in which Cuba Allen acted?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Music', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMusic' is a name of a category\nHow many actors acted in movies in the Music category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T3.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T5.name = 'Music'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T3.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T5.name = 'Music'",
"index": 4384,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Music', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nMusic' is a name of a category\nHow many actors acted in movies in the Music category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_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'Horror' is a name of a category; average rental payment refers to AVG(amount)\nWhat is the average rental payment in Horror movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(T5.amount) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id INNER JOIN inventory AS T3 ON T2.film_id = T3.film_id INNER JOIN rental AS T4 ON T3.inventory_id = T4.inventory_id INNER JOIN payment AS T5 ON T4.rental_id = T5.rental_id WHERE T1.name = 'Horror'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT AVG(T5.amount) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id INNER JOIN inventory AS T3 ON T2.film_id = T3.film_id INNER JOIN rental AS T4 ON T3.inventory_id = T4.inventory_id INNER JOIN payment AS T5 ON T4.rental_id = T5.rental_id WHERE T1.name = 'Horror'",
"index": 4385,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Horror', 'Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_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'Horror' is a name of a category; average rental payment refers to AVG(amount)\nWhat is the average rental payment in Horror movies?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['JOHNNY', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['JOHNNY', 'PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nforename means first_name; full name refers to first_name, last_name\nWhat are the actors that have the same forename as Johnny? Please include in your answer the full names of these actors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT first_name, last_name FROM actor WHERE first_name = 'Johnny'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT first_name, last_name FROM actor WHERE first_name = 'Johnny'",
"index": 4386,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['JOHNNY', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n language_id integer, -- example: [1]\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['JOHNNY', 'PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nforename means first_name; full name refers to first_name, last_name\nWhat are the actors that have the same forename as Johnny? Please include in your answer the full names of these actors.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['1623 Kingstown Drive', '47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Kingstown', 'A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich city does the address 1623 Kingstown Drive belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.city FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id WHERE T2.address = '1623 Kingstown Drive'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.city FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id WHERE T2.address = '1623 Kingstown Drive'",
"index": 4387,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['1623 Kingstown Drive', '47 MySakila Drive', '28 MySQL Boulevard']\n city_id integer, -- example: [300, 576]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Kingstown', 'A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWhich city does the address 1623 Kingstown Drive belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AGENT TRUMAN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AGENT TRUMAN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_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'Agent Truman' is a title of a film; category refers to name\nWhat is the category of the film Agent Truman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'AGENT TRUMAN'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'AGENT TRUMAN'",
"index": 4388,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AGENT TRUMAN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['AGENT TRUMAN', 'ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_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'Agent Truman' is a title of a film; category refers to name\nWhat is the category of the film Agent Truman?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naction is a name of category\nPlease list the titles of any three action 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.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Action' LIMIT 3",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Action' LIMIT 3",
"index": 4389,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naction is a name of category\nPlease list the titles of any three action 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 customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Children', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_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'children' AND 'action' are names of a category; Calculation = SUBTRACT(AVG('children'), AVG('action'))\nWhat is the difference between the number of children's films and action 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 SUM(IIF(T2.name = 'Children', 1, 0)) - SUM(IIF(T2.name = 'Action', 1, 0)) AS diff FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT SUM(IIF(T2.name = 'Children', 1, 0)) - SUM(IIF(T2.name = 'Action', 1, 0)) AS diff FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id",
"index": 4390,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Children', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n store_id integer, -- example: [1, 2]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_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'children' AND 'action' are names of a category; Calculation = SUBTRACT(AVG('children'), AVG('action'))\nWhat is the difference between the number of children's films and action 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 film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['WAY', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Santiago de Compostela', 'A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['1795 Santiago de Compostela Way', '47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Santiago', 'Texas', 'Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive refers to active = 1; '1795 Santiago de Compostela Way' is an address; Texas is a district; who refers to first_name, last_name\nWho is the customer that is active and lives at 1795 Santiago de Compostela Way, Texas?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.first_name, T1.last_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T2.address = '1795 Santiago de Compostela Way' AND T1.active = 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T2.address = '1795 Santiago de Compostela Way' AND T1.active = 1",
"index": 4391,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['WAY', 'SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['Santiago de Compostela', 'A Corua (La Corua)', 'Abha']\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['1795 Santiago de Compostela Way', '47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n district text, -- example: ['Santiago', 'Texas', 'Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nactive refers to active = 1; '1795 Santiago de Compostela Way' is an address; Texas is a district; who refers to first_name, last_name\nWho is the customer that is active and lives at 1795 Santiago de Compostela Way, Texas?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Documentary', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndocumentary' is a name of a category; calculation = DIVIDE(SUM(name = 'Documentary'), COUNT(film_id)) * 100\nWhat is the percentage of documentary 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 CAST(SUM(IIF(T2.name = 'Documentary', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT CAST(SUM(IIF(T2.name = 'Documentary', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id",
"index": 4392,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Documentary', 'Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n last_name text, -- example: ['Hillyer', 'Stephens']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndocumentary' is a name of a category; calculation = DIVIDE(SUM(name = 'Documentary'), COUNT(film_id)) * 100\nWhat is the percentage of documentary 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 film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['NC-17', 'PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEnglish is a name of a language; for adults only refers to rating = 'NC-17'\nHow many films in English are for adults only?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' AND T1.rating = 'NC-17'",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' AND T1.rating = 'NC-17'",
"index": 4393,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n length integer, -- example: [86, 48]\n rating text, -- example: ['NC-17', 'PG', 'G']\n special_features text, -- example: ['Deleted Scenes,Behind the Scenes', 'Trailers,Deleted Scenes']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nEnglish is a name of a language; for adults only refers to rating = 'NC-17'\nHow many films in English are for adults only?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_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 refers to the title; the longest duration refers to MAX(length)\nWhich film has the longest duration?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )",
"index": 4394,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address2 text,\n district text, -- example: ['Alberta', 'QLD']\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n store_id integer, -- example: [1, 2]\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n last_update datetime, -- example: ['2006-02-15 04:57:16.0']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n inventory_id integer, -- example: [367, 1525]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n original_language_id integer,\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_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 refers to the title; the longest duration refers to MAX(length)\nWhich film has the longest duration?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common first name refers to MAX(COUNT(first_name))\nWhat is the most common first name among the customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT first_name FROM customer GROUP BY first_name ORDER BY COUNT(first_name) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT first_name FROM customer GROUP BY first_name ORDER BY COUNT(first_name) DESC LIMIT 1",
"index": 4395,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n district text, -- example: ['Alberta', 'QLD']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most common first name refers to MAX(COUNT(first_name))\nWhat is the most common first name among the customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n release_year text, -- example: ['2006']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_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 largest number of films refers to MAX(rental_id)\nWhat is the largest number of films rented per customer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(rental_id) FROM rental GROUP BY customer_id ORDER BY COUNT(rental_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT COUNT(rental_id) FROM rental GROUP BY customer_id ORDER BY COUNT(rental_id) DESC LIMIT 1",
"index": 4396,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n country_id integer, -- example: [87, 82]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n release_year text, -- example: ['2006']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n customer_id integer, -- example: [130, 459]\n PRIMARY KEY (rental_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 largest number of films refers to MAX(rental_id)\nWhat is the largest number of films rented per customer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to first_name, last_name; the largest collection of films refers to MAX(film_id)\nWho is the manager of the store with the largest collection of 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 T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.film_id) AS num FROM inventory AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.film_id) AS num FROM inventory AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4397,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_name text, -- example: ['GUINESS', 'WAHLBERG']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n amount real, -- example: [2.99, 0.99]\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n last_name text, -- example: ['Hillyer', 'Stephens']\n store_id integer, -- example: [1, 2]\n username text, -- example: ['Mike', 'Jon']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n PRIMARY KEY (film_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWho refers to first_name, last_name; the largest collection of films refers to MAX(film_id)\nWho is the manager of the store with the largest collection of 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 category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninactive customers refers to active = 0;\nWhat are the addresses of the inactive customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.address FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.active = 0",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T2.address FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.active = 0",
"index": 4398,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n last_update datetime, -- example: ['2006-02-15 04:46:27.0']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:57:12.0']\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n first_name text, -- example: ['PENELOPE', 'NICK']\n last_update datetime, -- example: ['2006-02-15 04:34:33.0']\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n first_name text, -- example: ['Mike', 'Jon']\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n email text, -- email of the staff, example: ['Mike.Hillyer@sakilastaff.com', 'Jon.Stephens@sakilastaff.com']\n active integer, -- example: [1]\n username text, -- example: ['Mike', 'Jon']\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n address text, -- example: ['47 MySakila Drive', '28 MySQL Boulevard']\n address2 text,\n city_id integer, -- example: [300, 576]\n postal_code text, -- example: ['35200', '17886']\n last_update datetime, -- example: ['2006-02-15 04:45:30.0']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n return_date datetime, -- example: ['2005-05-26 22:04:30.0', '2005-05-28 19:40:33.0']\n staff_id integer, -- example: [1, 2]\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n city text, -- example: ['A Corua (La Corua)', 'Abha']\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n length integer, -- example: [86, 48]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country text, -- the name of the country, example: ['Afghanistan', 'Algeria']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n store_id integer, -- example: [1, 2]\n first_name text, -- example: ['MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n email text, -- example: ['MARY.SMITH@sakilacustomer.org', 'PATRICIA.JOHNSON@sakilacustomer.org']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninactive customers refers to active = 0;\nWhat are the addresses of the inactive customers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_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 common category refers to MAX(COUNT(category.name))\nWhich category is the most common?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.name FROM ( SELECT T2.name, COUNT(T2.name) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "movie_3.sqlite",
"gt_sql": "SELECT T.name FROM ( SELECT T2.name, COUNT(T2.name) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1",
"index": 4399,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE city (\n city_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:45:25.0']\n PRIMARY KEY (city_id)\n);\n\nCREATE TABLE category (\n category_id integer, -- example: [1, 2]\n name text, -- example: ['Action', 'Animation']\n PRIMARY KEY (category_id)\n);\n\nCREATE TABLE film (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n release_year text, -- example: ['2006']\n language_id integer, -- example: [1]\n original_language_id integer,\n rental_duration integer, -- example: [6, 3]\n rental_rate real, -- example: [0.99, 4.99]\n replacement_cost real, -- example: [20.99, 12.99]\n rating text, -- example: ['PG', 'G']\n last_update datetime, -- example: ['2006-02-15 05:03:42.0']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE payment (\n payment_id integer, -- example: [1, 2]\n customer_id integer, -- example: [1, 2]\n staff_id integer, -- example: [1, 2]\n rental_id integer, -- example: [76, 573]\n amount real, -- example: [2.99, 0.99]\n payment_date datetime, -- example: ['2005-05-25 11:30:37.0', '2005-05-28 10:35:23.0']\n last_update datetime, -- example: ['2006-02-15 22:12:30.0', '2006-02-15 22:12:31.0']\n PRIMARY KEY (payment_id)\n);\n\nCREATE TABLE film_text (\n film_id integer, -- example: [1, 2]\n title text, -- example: ['ACADEMY DINOSAUR', 'ACE GOLDFINGER']\n description text, -- example: ['A Epic Drama of a Feminist And a Mad Sci', 'A Astounding Epistle of a Database Admin']\n PRIMARY KEY (film_id)\n);\n\nCREATE TABLE staff (\n staff_id integer, -- example: [1, 2]\n address_id integer, -- example: [3, 4]\n picture blob, -- picture of the staff, example: ['0x3F504E470D0A1A0A0000000D49484452000000']\n active integer, -- example: [1]\n password text, -- example: ['8cb2237d0679ca88db6464eac60da96345513964']\n PRIMARY KEY (staff_id)\n);\n\nCREATE TABLE store (\n store_id integer, -- example: [1, 2]\n manager_staff_id integer, -- example: [1, 2]\n PRIMARY KEY (store_id)\n);\n\nCREATE TABLE actor (\n actor_id integer, -- example: [1, 2]\n PRIMARY KEY (actor_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- country id, example: [1, 2]\n first_name text, -- example: ['MAX', 'MARY', 'PATRICIA']\n last_name text, -- example: ['SMITH', 'JOHNSON']\n address_id integer, -- example: [5, 6]\n active integer, -- example: [1, 0]\n create_date datetime, -- example: ['2006-02-14 22:04:36.0', '2006-02-14 22:04:37.0']\n last_update datetime, -- example: ['2006-02-15 04:57:20.0']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE film_category (\n film_id integer, -- example: [1, 2]\n category_id integer, -- example: [6, 11]\n last_update datetime, -- example: ['2006-02-15 05:07:09.0']\n PRIMARY KEY (film_id, category_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n phone text, -- example: ['14033335568', '6172235589']\n PRIMARY KEY (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 04:44:00.0']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE film_actor (\n actor_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 23]\n last_update datetime, -- example: ['2006-02-15 05:05:03.0']\n PRIMARY KEY (actor_id, film_id)\n);\n\nCREATE TABLE inventory (\n inventory_id integer, -- example: [1, 2]\n film_id integer, -- example: [1, 2]\n store_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 05:09:17.0']\n PRIMARY KEY (inventory_id)\n);\n\nCREATE TABLE rental (\n rental_id integer, -- example: [1, 2]\n rental_date datetime, -- example: ['2005-05-24 22:53:30.0', '2005-05-24 22:54:33.0']\n customer_id integer, -- example: [130, 459]\n staff_id integer, -- example: [1, 2]\n last_update datetime, -- example: ['2006-02-15 21:30:53.0', '2006-02-23 04:12:08.0']\n PRIMARY KEY (rental_id)\n);\n\nCREATE TABLE `language` (\n language_id integer, -- example: [1, 2]\n name text, -- example: ['English', 'Italian']\n last_update datetime, -- example: ['2006-02-15 05:02:19.0']\n PRIMARY KEY (language_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 common category refers to MAX(COUNT(category.name))\nWhich category is the most common?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.