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 shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Thomas Nelson', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"Thomas Nelson\" is the publisher_name; oldest book refers to Min(publication_date)\nPlease give the title of the oldest book published by publisher \"Thomas Nelson\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson' ORDER BY T1.publication_date ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson' ORDER BY T1.publication_date ASC LIMIT 1",
"index": 2900,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Thomas Nelson', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"Thomas Nelson\" is the publisher_name; oldest book refers to Min(publication_date)\nPlease give the title of the oldest book published by publisher \"Thomas Nelson\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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:\nbook with the most pages refers to Max(num_pages); name of publisher refers to publisher_name\nWhat is the name of the publisher of the book with the most pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id ORDER BY T1.num_pages DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id ORDER BY T1.num_pages DESC LIMIT 1",
"index": 2901,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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:\nbook with the most pages refers to Max(num_pages); name of publisher refers to publisher_name\nWhat is the name of the publisher of the book with the most pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['British English', 'English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"British English\" is the language_name of the book\nPlease list the titles of all the books in British 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 T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'British English'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'British English'",
"index": 2902,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['British English', 'English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"British English\" is the language_name of the book\nPlease list the titles of all the books in British 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 customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Lucas', 'Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Wyldbore', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks have over 300 pages refers to num_pages > 300\nAmong the books ordered by Lucas Wyldbore, how many of them are over 300 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore' AND T1.num_pages > 300",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore' AND T1.num_pages > 300",
"index": 2903,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Lucas', 'Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Wyldbore', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks have over 300 pages refers to num_pages > 300\nAmong the books ordered by Lucas Wyldbore, how many of them are over 300 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Lucas', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Wyldbore', 'Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price refers to Sum(price)\nWhat is the total price of all the books ordered by Lucas Wyldbore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.price) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'",
"index": 2904,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Lucas', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Wyldbore', 'Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price refers to Sum(price)\nWhat is the total price of all the books ordered by Lucas Wyldbore?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Lucas', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Wyldbore', 'Price', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks over $13 refers to price > 13; percentage = Divide (Sum (order_id where price > 13), Count (order_id)) * 100\nAmong the books ordered by Lucas Wyldbore, what is the percentage of those books over $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(CASE WHEN T1.price > 13 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.price > 13 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'",
"index": 2905,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Lucas', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Wyldbore', 'Price', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks over $13 refers to price > 13; percentage = Divide (Sum (order_id where price > 13), Count (order_id)) * 100\nAmong the books ordered by Lucas Wyldbore, what is the percentage of those books over $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 book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_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 id 547 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 city FROM address WHERE address_id = 547",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT city FROM address WHERE address_id = 547",
"index": 2906,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_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 id 547 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 cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanguage written in refers to language_name;\nWhich language was book id 1405 written 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 T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.book_id = 1405",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.book_id = 1405",
"index": 2907,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlanguage written in refers to language_name;\nWhich language was book id 1405 written 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 author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_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 street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Hi', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\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 order refers to Max(Count(order_id)); customer refers to first_name, last_name\nWhich customer has made the most orders? Show his/her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1",
"index": 2908,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_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 street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Hi', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\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 order refers to Max(Count(order_id)); customer refers to first_name, last_name\nWhich customer has made the most orders? Show his/her full name.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['David Foster Wallace', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_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\"David Foster Wallace\" is the author_name;\nHow many books did David Foster Wallace write?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Foster Wallace'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(T1.title) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Foster Wallace'",
"index": 2909,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['David Foster Wallace', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_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\"David Foster Wallace\" is the author_name;\nHow many books did David Foster Wallace write?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\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 order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['O Xará', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_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\"O Xará\" is the title of the book\nHow many orders does the book \"O Xará\" have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'O Xará'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'O Xará'",
"index": 2910,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\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 order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['O Xará', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_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\"O Xará\" is the title of the book\nHow many orders does the book \"O Xará\" have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['International', 'Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\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:\nInternational shipping order refers to method_name = 'International'; orders on 2022/11/10 refers to order_date LIKE '2022-11-10%'; percentage = Divide (Sum(order_id where method_name = 'International'), Count(order_id)) * 100\nCalculate the percentage of the International shipping orders on 2022/11/10.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipping_method AS T1 INNER JOIN cust_order AS T2 ON T1.method_id = T2.shipping_method_id WHERE T2.order_date LIKE '2022-11-10%'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipping_method AS T1 INNER JOIN cust_order AS T2 ON T1.method_id = T2.shipping_method_id WHERE T2.order_date LIKE '2022-11-10%'",
"index": 2911,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['International', 'Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\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:\nInternational shipping order refers to method_name = 'International'; orders on 2022/11/10 refers to order_date LIKE '2022-11-10%'; percentage = Divide (Sum(order_id where method_name = 'International'), Count(order_id)) * 100\nCalculate the percentage of the International shipping orders on 2022/11/10.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nslowest and least expesive method refers to shipping_method = 'Standard'\nWhat is the cost of the slowest and least expensive shipping method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT method_name FROM shipping_method ORDER BY cost ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT method_name FROM shipping_method ORDER BY cost ASC LIMIT 1",
"index": 2912,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nslowest and least expesive method refers to shipping_method = 'Standard'\nWhat is the cost of the slowest and least expensive shipping method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished in 1900 refers to publication_date LIKE '1900%'; first book refers to Min(publication_date)\nWhat is the title of the first book that was published in 1900?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book WHERE STRFTIME('%Y', publication_date) = '1900' ORDER BY publication_date LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1900' ORDER BY publication_date LIMIT 1",
"index": 2913,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished in 1900 refers to publication_date LIKE '1900%'; first book refers to Min(publication_date)\nWhat is the title of the first book that was published in 1900?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n email text, -- example: ['aalleburtonkc@yellowbook.com', 'upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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\"aalleburtonkc@yellowbook.com\" is the email of customer; full name refers to first_name, last_name\nWhat is the full name of the customer who owns the \"aalleburtonkc@yellowbook.com\" e-mail 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 first_name, last_name FROM customer WHERE email = 'aalleburtonkc@yellowbook.com'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT first_name, last_name FROM customer WHERE email = 'aalleburtonkc@yellowbook.com'",
"index": 2914,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n email text, -- example: ['aalleburtonkc@yellowbook.com', 'upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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\"aalleburtonkc@yellowbook.com\" is the email of customer; full name refers to first_name, last_name\nWhat is the full name of the customer who owns the \"aalleburtonkc@yellowbook.com\" e-mail 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 cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Iran', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIran as their destination refers to country_name = 'Iran'; orders in 2022 refers to order_date LIKE '2022%'\nHow many orders in 2022 have Iran as their destinations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id INNER JOIN cust_order AS T3 ON T3.dest_address_id = T2.address_id WHERE T1.country_name = 'Iran' AND STRFTIME('%Y', T3.order_date) = '2022'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id INNER JOIN cust_order AS T3 ON T3.dest_address_id = T2.address_id WHERE T1.country_name = 'Iran' AND STRFTIME('%Y', T3.order_date) = '2022'",
"index": 2915,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Iran', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nIran as their destination refers to country_name = 'Iran'; orders in 2022 refers to order_date LIKE '2022%'\nHow many orders in 2022 have Iran as their destinations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['International', 'Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Daisey', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Lamball', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nvia international shipping refers to method_name = 'International'\nAmong Daisey Lamball's orders, how many were shipped via International shipping?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Daisey' AND T1.last_name = 'Lamball' AND T3.method_name = 'International'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Daisey' AND T1.last_name = 'Lamball' AND T3.method_name = 'International'",
"index": 2916,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['International', 'Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Daisey', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Lamball', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nvia international shipping refers to method_name = 'International'\nAmong Daisey Lamball's orders, how many were shipped via International shipping?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['It Books', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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 who ordered the most book refers to customer_id where Max(count(order_id)); full name refers to first_name, last_name\nWhat is the full name of the customer who ordered the most books 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 T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1",
"index": 2917,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['It Books', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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 who ordered the most book refers to customer_id where Max(count(order_id)); full name refers to first_name, last_name\nWhat is the full name of the customer who ordered the most books 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 address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Antonia', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Poltun', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Returned', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_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:\norder returned refers to status_value = 'Returned'\nHow many orders did Antonia Poltun return?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.status_value = 'Returned' AND T4.first_name = 'Antonia' AND T4.last_name = 'Poltun'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.status_value = 'Returned' AND T4.first_name = 'Antonia' AND T4.last_name = 'Poltun'",
"index": 2918,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Antonia', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Poltun', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Returned', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_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:\norder returned refers to status_value = 'Returned'\nHow many orders did Antonia Poltun return?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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:\nshipping method preferred the most by customers refers to method_id where Max(Count(method_id)); which shipping method refers to method_name\nWhich shipping method is preferred by customers the most?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) DESC LIMIT 1",
"index": 2919,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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:\nshipping method preferred the most by customers refers to method_id where Max(Count(method_id)); which shipping method refers to method_name\nWhich shipping method is preferred by customers the most?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.R. Braunmuller', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"A.R. Braunmuller\" is the author_name\nHow many books did A.R. Braunmuller write?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'A.R. Braunmuller'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'A.R. Braunmuller'",
"index": 2920,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.R. Braunmuller', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"A.R. Braunmuller\" is the author_name\nHow many books did A.R. Braunmuller write?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Agatha Christie', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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\"Agatha Christie\" is the author_name; name of publisher refers to publisher_name; first book refers to Min(publication_date)\nWhat is the name of the publisher who published Agatha Christie's first book?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Agatha Christie' ORDER BY T1.publication_date ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Agatha Christie' ORDER BY T1.publication_date ASC LIMIT 1",
"index": 2921,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Agatha Christie', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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\"Agatha Christie\" is the author_name; name of publisher refers to publisher_name; first book refers to Min(publication_date)\nWhat is the name of the publisher who published Agatha Christie's first book?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['All the Names', 'The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Danielle Steel', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_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\"Danielle Steel\" is the author_name; name of books refers to title\nList all the names of the books written by Danielle Steel.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Danielle Steel'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Danielle Steel'",
"index": 2922,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['All the Names', 'The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Danielle Steel', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_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\"Danielle Steel\" is the author_name; name of books refers to title\nList all the names of the books written by Danielle Steel.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Penguin Classics', 'Penguin Classic', 'Penguin', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['William Shakespeare', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_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\"William Shakespeare\" is the author_name; \"Penguin Classics\" is the publisher_name\nHow many books by William Shakespeare were published by Penguin Classics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'William Shakespeare' AND T4.publisher_name = 'Penguin Classics'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'William Shakespeare' AND T4.publisher_name = 'Penguin Classics'",
"index": 2923,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Penguin Classics', 'Penguin Classic', 'Penguin', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['William Shakespeare', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_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\"William Shakespeare\" is the author_name; \"Penguin Classics\" is the publisher_name\nHow many books by William Shakespeare were published by Penguin Classics?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_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 street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['It Books', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_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 publisher refers to publisher_name; publisher published the most number of books refers to Max(Count(book_id))\nWhat is the name of the publisher that published the most books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1",
"index": 2924,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_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 street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['It Books', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_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 publisher refers to publisher_name; publisher published the most number of books refers to Max(Count(book_id))\nWhat is the name of the publisher that published the most books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_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 publisher refers to publisher_name\nWhat is the name of the publisher with publisher ID 22?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT publisher_name FROM publisher WHERE publisher_id = 22",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT publisher_name FROM publisher WHERE publisher_id = 22",
"index": 2925,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_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 publisher refers to publisher_name\nWhat is the name of the publisher with publisher ID 22?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Al Gore', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_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\"AI Gore\" is the author_name; have less than 400 pages refers to num_pages < 400\nHow many of the books authored by Al Gore have less than 400 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Al Gore' AND T1.num_pages < 400",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Al Gore' AND T1.num_pages < 400",
"index": 2926,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Al Gore', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_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\"AI Gore\" is the author_name; have less than 400 pages refers to num_pages < 400\nHow many of the books authored by Al Gore have less than 400 pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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\"23755004321\" is the isbn13; language refers to language_name\nWhat is the language of the book with ISBN 23755004321?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.isbn13 = 23755004321",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.isbn13 = 23755004321",
"index": 2927,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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\"23755004321\" is the isbn13; language refers to language_name\nWhat is the language of the book with ISBN 23755004321?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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 expensive book refers to Max(price)\nWhat is the title of the most expensive book?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id ORDER BY T2.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id ORDER BY T2.price DESC LIMIT 1",
"index": 2928,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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 expensive book refers to Max(price)\nWhat is the title of the most expensive book?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['Spanish', 'English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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\"Spanish\" is the language_name; ISBN refers to isbn13\nList the ISBN of the book published in Spanish.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.isbn13 FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Spanish'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.isbn13 FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Spanish'",
"index": 2929,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['Spanish', 'English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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\"Spanish\" is the language_name; ISBN refers to isbn13\nList the ISBN of the book published in Spanish.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Zia', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Roizin', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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:\nList the title of the books purchased by the customer named Zia Roizin.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Zia' AND T4.last_name = 'Roizin'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Zia' AND T4.last_name = 'Roizin'",
"index": 2930,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Zia', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Roizin', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_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:\nList the title of the books purchased by the customer named Zia Roizin.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngreatest number of pages refers to Max(num_pages); who authored refers to author_name\nWho authored the book with greatest number of pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1",
"index": 2931,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngreatest number of pages refers to Max(num_pages); who authored refers to author_name\nWho authored the book with greatest number of pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished in 2004 refers to publication_date LIKE '2004%'; books with number of pages greater than 70% of the average number of pages refers to num_pages > Multiply(Avg(num_pages), 0.7); name of publisher refers to publisher_name\nAmong the books published in 2004, list the name of the publisher of books with number of pages greater than 70% of the average number of pages of all books.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.title, T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE STRFTIME('%Y', T1.publication_date) = '2004' AND T1.num_pages * 100 > ( SELECT AVG(num_pages) FROM book ) * 70",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title, T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE STRFTIME('%Y', T1.publication_date) = '2004' AND T1.num_pages * 100 > ( SELECT AVG(num_pages) FROM book ) * 70",
"index": 2932,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished in 2004 refers to publication_date LIKE '2004%'; books with number of pages greater than 70% of the average number of pages refers to num_pages > Multiply(Avg(num_pages), 0.7); name of publisher refers to publisher_name\nAmong the books published in 2004, list the name of the publisher of books with number of pages greater than 70% of the average number of pages of all books.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Moss', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Zarb', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the contact email of Moss Zarb.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 = 'Moss' AND last_name = 'Zarb'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT email FROM customer WHERE first_name = 'Moss' AND last_name = 'Zarb'",
"index": 2933,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Moss', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Zarb', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProvide the contact email of Moss Zarb.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Prophet', 'Prophet', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"The Prophet\" is the title of the book: who wrote refers to author_name\nWho wrote \"The Prophet\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Prophet'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Prophet'",
"index": 2934,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Prophet', 'Prophet', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"The Prophet\" is the title of the book: who wrote refers to author_name\nWho wrote \"The Prophet\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Ace Hardcover', 'Ace', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"Ace Hardcover\" is the publisher_name\nHow many books were published by Ace Hardcover?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Ace Hardcover'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Ace Hardcover'",
"index": 2935,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Ace Hardcover', 'Ace', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"Ace Hardcover\" is the publisher_name\nHow many books were published by Ace Hardcover?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Daisey', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Lamball', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_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 2021 refers to order_date LIKE '2021%'\nProvide the number of orders by Daisey Lamball in 2021.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Daisey' AND T2.last_name = 'Lamball' AND STRFTIME('%Y', T1.order_date) = '2021'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Daisey' AND T2.last_name = 'Lamball' AND STRFTIME('%Y', T1.order_date) = '2021'",
"index": 2936,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Daisey', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Lamball', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_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 2021 refers to order_date LIKE '2021%'\nProvide the number of orders by Daisey Lamball in 2021.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\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 customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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:\nyear with the most customer orders refers to Max(count(order_id))\nWhich year has the most customer orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_date)) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_date)) DESC LIMIT 1",
"index": 2937,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\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 customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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:\nyear with the most customer orders refers to Max(count(order_id))\nWhich year has the most customer orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nmost common domain for the email refers to Max(Count(SUBSTR(email, CHARINDEX('@', email) + 1, length(email) - charindex('@', email))))\nWhat is the most common domain for the email address among all 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 SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) AS ym FROM customer GROUP BY SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) ORDER BY COUNT(*) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) AS ym FROM customer GROUP BY SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) ORDER BY COUNT(*) DESC LIMIT 1",
"index": 2938,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nmost common domain for the email refers to Max(Count(SUBSTR(email, CHARINDEX('@', email) + 1, length(email) - charindex('@', email))))\nWhat is the most common domain for the email address among all 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 customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublisher have the word 'book' refers to publisher_name LIKE '%book%'\nHow many publishers have the word \"book\" in their 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(*) FROM publisher WHERE publisher_name LIKE '%book%'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%book%'",
"index": 2939,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublisher have the word 'book' refers to publisher_name LIKE '%book%'\nHow many publishers have the word \"book\" in their 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 country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nlanguage written in refers to language_name; rarest refers to Min(Count(book_id))\nWhich language is the rarest among all the books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id GROUP BY T2.language_name ORDER BY COUNT(T2.language_name) ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id GROUP BY T2.language_name ORDER BY COUNT(T2.language_name) ASC LIMIT 1",
"index": 2940,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nlanguage written in refers to language_name; rarest refers to Min(Count(book_id))\nWhich language is the rarest among all the books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Adrian', 'Adriane', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Kunzelmann', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the order dates for the customer named \"Adrian Kunzelmann\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.order_date FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Adrian' AND T4.last_name = 'Kunzelmann'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.order_date FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Adrian' AND T4.last_name = 'Kunzelmann'",
"index": 2941,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Adrian', 'Adriane', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Kunzelmann', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nList all the order dates for the customer named \"Adrian Kunzelmann\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Philippines', 'Afghanistan', 'Netherlands Antilles']\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\"Philippines\" is the country_name\nHow many addresses are from the Philippines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.country_id) FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Philippines'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(T2.country_id) FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Philippines'",
"index": 2942,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Philippines', 'Afghanistan', 'Netherlands Antilles']\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\"Philippines\" is the country_name\nHow many addresses are from the Philippines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nauthor refers to author_name; who wrote the most book refers to Max(Count(author_id))\nWho is the author who wrote the most books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1",
"index": 2943,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nauthor refers to author_name; who wrote the most book refers to Max(Count(author_id))\nWho is the author who wrote the most books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmethod of shipping refers to method_name; least method refers to Min(Count(method_id))\nWhat is the second-least common method of shipping?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) ASC LIMIT 1, 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) ASC LIMIT 1, 1",
"index": 2944,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmethod of shipping refers to method_name; least method refers to Min(Count(method_id))\nWhat is the second-least common method of shipping?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Inactive', 'Active']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\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:\naddresses are inactive refers to address_status = 'Inactive'\nHow many of the customer addresses are inactive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive'",
"index": 2945,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Inactive', 'Active']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\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:\naddresses are inactive refers to address_status = 'Inactive'\nHow many of the customer addresses are inactive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nbooks refers to title; the most orders refers to Max(Count(order_id))\nWhat is the book with the most orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1",
"index": 2946,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nbooks refers to title; the most orders refers to Max(Count(order_id))\nWhat is the book with the most orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_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\"2398\" is the order_id; time = Subtract(strftime('%Y', status_date), strftime('%Y', order_date)) AS \"year\" , Subtract(strftime('%m', status_date), strftime('%m', order_date)) AS \"month\", Subtract (strftime('%d', status_date), strftime('%d', order_date)) AS \"day\"\nHow much time does it take to update the status of order \"2398\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT strftime('%J', T2.status_date) - strftime('%J', T1.order_date) FROM cust_order AS T1 INNER JOIN order_history AS T2 ON T1.order_id = T2.order_id WHERE T1.order_id = 2398",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT strftime('%J', T2.status_date) - strftime('%J', T1.order_date) FROM cust_order AS T1 INNER JOIN order_history AS T2 ON T1.order_id = T2.order_id WHERE T1.order_id = 2398",
"index": 2947,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_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\"2398\" is the order_id; time = Subtract(strftime('%Y', status_date), strftime('%Y', order_date)) AS \"year\" , Subtract(strftime('%m', status_date), strftime('%m', order_date)) AS \"month\", Subtract (strftime('%d', status_date), strftime('%d', order_date)) AS \"day\"\nHow much time does it take to update the status of order \"2398\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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:\ncustomer refers to first_name, last_name; the most address refers to Max(count(address_id))\nWhich customer has the most addresses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 customer_address AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(T2.customer_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(T2.customer_id) DESC LIMIT 1",
"index": 2948,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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:\ncustomer refers to first_name, last_name; the most address refers to Max(count(address_id))\nWhich customer has the most addresses?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nauthors named Adam refers to author_name LIKE 'Adam'\nHow many authors are named Adam?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM author WHERE author_name LIKE 'Adam%'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM author WHERE author_name LIKE 'Adam%'",
"index": 2949,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nauthors named Adam refers to author_name LIKE 'Adam'\nHow many authors are named Adam?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYahoo! Mail e-mail address refers to email LIKE '%@yahoo.com'\nHow many customers use a Yahoo! Mail e-mail 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 COUNT(*) FROM customer WHERE email LIKE '%@yahoo.com'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM customer WHERE email LIKE '%@yahoo.com'",
"index": 2950,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nYahoo! Mail e-mail address refers to email LIKE '%@yahoo.com'\nHow many customers use a Yahoo! Mail e-mail 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 order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_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 expensive book refers to Max(price)\nWhich books have the most expensive price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id ORDER BY T1.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id ORDER BY T1.price DESC LIMIT 1",
"index": 2951,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_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 expensive book refers to Max(price)\nWhich books have the most expensive price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['Anleitung zum Zickigsein', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"Anleitung zum Zickigsein\" is the title of the book\nHow many customers ordered the book titled \"Anleitung zum Zickigsein\"\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Anleitung zum Zickigsein'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Anleitung zum Zickigsein'",
"index": 2952,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['Anleitung zum Zickigsein', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"Anleitung zum Zickigsein\" is the title of the book\nHow many customers ordered the book titled \"Anleitung zum Zickigsein\"\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['Bite Me If You Can (Argeneau #6)', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_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\"Bite Me If You Can (Argeneau #6)\" is the title of the book; most expensive price refers to Max(price)\nWhat is the most expensive price paid by a customer for the book \"Bite Me If You Can (Argeneau #6)\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Bite Me If You Can (Argeneau #6)'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Bite Me If You Can (Argeneau #6)'",
"index": 2953,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['Bite Me If You Can (Argeneau #6)', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_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\"Bite Me If You Can (Argeneau #6)\" is the title of the book; most expensive price refers to Max(price)\nWhat is the most expensive price paid by a customer for the book \"Bite Me If You Can (Argeneau #6)\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Secret Garden', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_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\"The Secret Garden\" is the title of the book; who published the book refers to publisher_name\nWho published the book \"The Secret Garden\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Secret Garden'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT DISTINCT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Secret Garden'",
"index": 2954,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Secret Garden', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_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\"The Secret Garden\" is the title of the book; who published the book refers to publisher_name\nWho published the book \"The Secret Garden\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished at least 30 books refers to Count(book_id) > = 30\nWhat are the names of all the publishers who have published at least 30 books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name HAVING COUNT(T2.publisher_name) >= 30",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name HAVING COUNT(T2.publisher_name) >= 30",
"index": 2955,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Names', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished at least 30 books refers to Count(book_id) > = 30\nWhat are the names of all the publishers who have published at least 30 books?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Lazaro Cardenas', 'Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomplete address refers to street_number, street_name, city, country; \"Lazaro Cardenas\" is the city\nIndicate the complete address of customers located in Lazaro Cardenas.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT street_number, street_name, city, country_id FROM address WHERE city = 'Lazaro Cardenas'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT street_number, street_name, city, country_id FROM address WHERE city = 'Lazaro Cardenas'",
"index": 2956,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Lazaro Cardenas', 'Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomplete address refers to street_number, street_name, city, country; \"Lazaro Cardenas\" is the city\nIndicate the complete address of customers located in Lazaro Cardenas.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\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:\ngreatest potential value refers to Min(publication_date)\nIndicate the title of the six books with the greatest potential value as collectibles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book ORDER BY publication_date ASC LIMIT 6",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT title FROM book ORDER BY publication_date ASC LIMIT 6",
"index": 2957,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\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:\ngreatest potential value refers to Min(publication_date)\nIndicate the title of the six books with the greatest potential value as collectibles.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Costa', 'Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Costa Rica', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"Costa Rica\" is the country_name\nIn which cities are the customers of Costa Rica located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Costa Rica'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Costa Rica'",
"index": 2958,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Costa', 'Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Costa Rica', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"Costa Rica\" is the country_name\nIn which cities are the customers of Costa Rica located?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Priority', 'Standard']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npriority method refers to method_name = 'Priority'\nWhat is the email of the customers who place their orders with priority method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.email FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T3.method_name = 'Priority'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.email FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T3.method_name = 'Priority'",
"index": 2959,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Priority', 'Standard']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npriority method refers to method_name = 'Priority'\nWhat is the email of the customers who place their orders with priority method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlive at number 460 refers to street_number = '460'; date the customers placed their orders refers to order_date\nOn what date did the customers who live at number 460 of their respective streets place their orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.order_date FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id WHERE T2.street_number = 460",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.order_date FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id WHERE T2.street_number = 460",
"index": 2960,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlive at number 460 refers to street_number = '460'; date the customers placed their orders refers to order_date\nOn what date did the customers who live at number 460 of their respective streets place their orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Cancelled', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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:\nhave been cancelled refers to status_value = 'cancelled'; id refers to order_id\nIdentify by their id all the orders that have been cancelled.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.order_id FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.order_id FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled'",
"index": 2961,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Cancelled', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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:\nhave been cancelled refers to status_value = 'cancelled'; id refers to order_id\nIdentify by their id all the orders that have been cancelled.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprice of 16.54 refers to price = 16.54; dates the book ordered refers to order_date\nOn what dates were books ordered at a price of 16.54?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.order_date FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id WHERE T2.price = 16.54",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.order_date FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id WHERE T2.price = 16.54",
"index": 2962,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprice of 16.54 refers to price = 16.54; dates the book ordered refers to order_date\nOn what dates were books ordered at a price of 16.54?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['HarperCollins Publishers', 'HarperCollins', 'HarperCollins Publishers Ltd', 'HarperCollins UK', 'HarperCollins Publishers Inc.', '10/18']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nunder 300 pages refers to num_pages < 300; 'HarperCollins Publishers\" is the publisher_name\nHow many books under 300 pages has HarperCollins Publishers published?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'HarperCollins Publishers' AND T1.num_pages < 300",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'HarperCollins Publishers' AND T1.num_pages < 300",
"index": 2963,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['HarperCollins Publishers', 'HarperCollins', 'HarperCollins Publishers Ltd', 'HarperCollins UK', 'HarperCollins Publishers Inc.', '10/18']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nunder 300 pages refers to num_pages < 300; 'HarperCollins Publishers\" is the publisher_name\nHow many books under 300 pages has HarperCollins Publishers published?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['Japanese', 'English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_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 Japanese refers to language_name = 'Japanese\nHow many books have been published in Japanese?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'",
"index": 2964,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['Japanese', 'English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_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 Japanese refers to language_name = 'Japanese\nHow many books have been published in Japanese?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['International', 'Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Kaleena', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipped by international method refers to method_name = 'International'; percentage = Divide (Sum(method_name = 'International'), Count(method_name)) * 100\nWhat percentage of the orders placed by Kaleena were shipped by the international method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Kaleena'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Kaleena'",
"index": 2965,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['International', 'Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Kaleena', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshipped by international method refers to method_name = 'International'; percentage = Divide (Sum(method_name = 'International'), Count(method_name)) * 100\nWhat percentage of the orders placed by Kaleena were shipped by the international method?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Sorrows of Young Werther', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_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; 'The Sorrows of Young Werther' is the title of the book\nProvide the full name of the customers who have ordered the book The Sorrows of Young Werther.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'The Sorrows of Young Werther'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'The Sorrows of Young Werther'",
"index": 2966,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Sorrows of Young Werther', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Full', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_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; 'The Sorrows of Young Werther' is the title of the book\nProvide the full name of the customers who have ordered the book The Sorrows of Young Werther.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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:\nbook refers to title\nList every book that Ursola Purdy has ordered.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Ursola' AND T4.last_name = 'Purdy'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Ursola' AND T4.last_name = 'Purdy'",
"index": 2967,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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:\nbook refers to title\nList every book that Ursola Purdy has ordered.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nauthor refers to author_name, biggest page count refers to Max(num_pages)\nWho is the author of the book with the biggest page count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1",
"index": 2968,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nauthor refers to author_name, biggest page count refers to Max(num_pages)\nWho is the author of the book with the biggest page count?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Mystery in the Rocky Mountains', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Mystery', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Rocky', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\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:\nauthor refers to author_name; 'The Mystery in the Rocky Mountains' is the title of the book\nWho is the author of the book The Mystery in the Rocky Mountains?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Mystery in the Rocky Mountains'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Mystery in the Rocky Mountains'",
"index": 2969,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Mystery in the Rocky Mountains', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Mystery', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Rocky', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\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:\nauthor refers to author_name; 'The Mystery in the Rocky Mountains' is the title of the book\nWho is the author of the book The Mystery in the Rocky Mountains?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"Girls' Night In\", \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_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\"Girls' Night In\" is the title of the book; publisher is the publisher_name\nIdentify the publisher of the book Girls' Night 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 T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Girls'' Night In'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Girls'' Night In'",
"index": 2970,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"Girls' Night In\", \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_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\"Girls' Night In\" is the title of the book; publisher is the publisher_name\nIdentify the publisher of the book Girls' Night 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 address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Cancelled', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncancelled refers to status_value = 'Cancelled'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'\nHow many orders have been cancelled in 2022?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled' AND STRFTIME('%Y', T2.status_date) = '2022'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled' AND STRFTIME('%Y', T2.status_date) = '2022'",
"index": 2971,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Cancelled', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncancelled refers to status_value = 'Cancelled'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'\nHow many orders have been cancelled in 2022?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['BBC Audiobooks', 'List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"BBC Audiobooks\" refers to publisher_name; books refers to title\nList all the books published by BBC Audiobooks.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'BBC Audiobooks'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'BBC Audiobooks'",
"index": 2972,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['BBC Audiobooks', 'List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\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\"BBC Audiobooks\" refers to publisher_name; books refers to title\nList all the books published by BBC Audiobooks.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Mystery in the Rocky Mountains', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInternational Standard Book Number refers to isbn13; 'The Mystery in the Rocky Mountains' is the title of the book\nProvide the International Standard Book Number of the book The Mystery in the Rocky Mountains.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT isbn13 FROM book WHERE title = 'The Mystery in the Rocky Mountains'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT isbn13 FROM book WHERE title = 'The Mystery in the Rocky Mountains'",
"index": 2973,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Mystery in the Rocky Mountains', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nInternational Standard Book Number refers to isbn13; 'The Mystery in the Rocky Mountains' is the title of the book\nProvide the International Standard Book Number of the book The Mystery in the Rocky Mountains.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Returned', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder updated in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'; has been returned refers to status_value = 'Returned'; percentage = Divide (Count(status_value = 'Returned'), Count(status_value)) * 100\nAmong all orders updated in 2022, identify the percentage that has been 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 CAST(SUM(CASE WHEN T1.status_value = 'Returned' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE STRFTIME('%Y', T2.status_date) = '2022'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.status_value = 'Returned' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE STRFTIME('%Y', T2.status_date) = '2022'",
"index": 2974,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Returned', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder updated in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'; has been returned refers to status_value = 'Returned'; percentage = Divide (Count(status_value = 'Returned'), Count(status_value)) * 100\nAmong all orders updated in 2022, identify the percentage that has been 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 address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Inactive', 'Active']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_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 not in use refers to address_status = 'Inactive'; percentage = Divide (Count(address_status = 'Inactive'), Count(address_status)) * 100\nAmong all addresses provided by customers, identify the percentage that are not in use anymore.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T2.address_status = 'Inactive' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T2.status_id = T1.status_id",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.address_status = 'Inactive' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T2.status_id = T1.status_id",
"index": 2975,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Inactive', 'Active']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_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 not in use refers to address_status = 'Inactive'; percentage = Divide (Count(address_status = 'Inactive'), Count(address_status)) * 100\nAmong all addresses provided by customers, identify the percentage that are not in use anymore.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['Seaward', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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\"Seaward\" is the title of the book; pages refers to num_pages\nHow many pages does 'Seaward' have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT num_pages FROM book WHERE title = 'Seaward'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT num_pages FROM book WHERE title = 'Seaward'",
"index": 2976,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['Seaward', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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\"Seaward\" is the title of the book; pages refers to num_pages\nHow many pages does 'Seaward' have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Tom Clancy', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_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\"Tom Clancy\" is the author_name; books refers title\nList all books authored by Tom Clancy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Tom Clancy'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Tom Clancy'",
"index": 2977,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Tom Clancy', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_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\"Tom Clancy\" is the author_name; books refers title\nList all books authored by Tom Clancy.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Dorton Pass', 'Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Huangqiao', 'Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Pass', 'Full', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_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; '55' is the street_number, 'Dorton Pass' is the street_name; 'Huangqiao' is the city\nWrite the full name of the customers whose address is at 55 Dorton Pass, Huangqiao.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id WHERE T3.street_number = 55 AND T3.street_name = 'Dorton Pass' AND T3.city = 'Huangqiao'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT DISTINCT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id WHERE T3.street_number = 55 AND T3.street_name = 'Dorton Pass' AND T3.city = 'Huangqiao'",
"index": 2978,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Dorton Pass', 'Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Huangqiao', 'Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Pass', 'Full', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_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; '55' is the street_number, 'Dorton Pass' is the street_name; 'Huangqiao' is the city\nWrite the full name of the customers whose address is at 55 Dorton Pass, Huangqiao.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Green Ridge Point', 'Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Arendal', 'Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_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\"9\" is the street_number; 'Green Reidge Point' is the street_name; 'Arendal' is the city\nWhich country is 9 Green Ridge Point, Arendal located at?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.country_name FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T1.street_number = 9 AND T1.street_name = 'Green Ridge Point' AND T1.city = 'Arendal'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.country_name FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T1.street_number = 9 AND T1.street_name = 'Green Ridge Point' AND T1.city = 'Arendal'",
"index": 2979,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Green Ridge Point', 'Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Arendal', 'Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_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\"9\" is the street_number; 'Green Reidge Point' is the street_name; 'Arendal' is the city\nWhich country is 9 Green Ridge Point, Arendal located at?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Poland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_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\"Polan\" is the country_name; address refers to street_number, street_name, city\nList 10 addresses located in Poland.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.street_number, T1.street_name, T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Poland' LIMIT 10",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.street_number, T1.street_name, T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Poland' LIMIT 10",
"index": 2980,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Poland', 'Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_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\"Polan\" is the country_name; address refers to street_number, street_name, city\nList 10 addresses located in Poland.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2020-06-29 19:40:07', '2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Nicolette', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Sadler', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered at 6/29/2020 7:40:07 PM refers to order_date = '2020-06-29 19:40:07'; shipping method refers to method_name\nWhat is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.method_name FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id WHERE T2.first_name = 'Nicolette' AND T2.last_name = 'Sadler' AND T1.order_date = '2020-06-29 19:40:07'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.method_name FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id WHERE T2.first_name = 'Nicolette' AND T2.last_name = 'Sadler' AND T1.order_date = '2020-06-29 19:40:07'",
"index": 2981,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2020-06-29 19:40:07', '2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Nicolette', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Sadler', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nordered at 6/29/2020 7:40:07 PM refers to order_date = '2020-06-29 19:40:07'; shipping method refers to method_name\nWhat is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Zilpha Keatley Snyder', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_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\"Zilpha Keatley Snyder\" is the author_name; average number of book pages refers to AVG(num_pages)\nWhat is the average number of book pages written by Zilpha Keatley Snyder?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.num_pages) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id INNER JOIN book AS T3 ON T3.book_id = T1.book_id WHERE T2.author_name = 'Zilpha Keatley Snyder'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT AVG(T3.num_pages) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id INNER JOIN book AS T3 ON T3.book_id = T1.book_id WHERE T2.author_name = 'Zilpha Keatley Snyder'",
"index": 2982,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['Zilpha Keatley Snyder', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_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\"Zilpha Keatley Snyder\" is the author_name; average number of book pages refers to AVG(num_pages)\nWhat is the average number of book pages written by Zilpha Keatley Snyder?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nbooks with the most number of pages refers to Max(num_pages)\nWhich book has the most number of pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book ORDER BY num_pages DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT title FROM book ORDER BY num_pages DESC LIMIT 1",
"index": 2983,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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:\nbooks with the most number of pages refers to Max(num_pages)\nWhich book has the most number of pages?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.J. Ayer', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"A.J. Ayer\" is the author_name;\nHow many books were written by author A.J. Ayer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id WHERE T2.author_name = 'A.J. Ayer'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id WHERE T2.author_name = 'A.J. Ayer'",
"index": 2984,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.J. Ayer', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"A.J. Ayer\" is the author_name;\nHow many books were written by author A.J. Ayer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.J. Ayer', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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\"A.J. Ayer\" is the author_name;\nName the title of books written by author A.J.Ayer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id INNER JOIN book AS T3 ON T3.book_id = T1.book_id WHERE T2.author_name = 'A.J. Ayer'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.title FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id INNER JOIN book AS T3 ON T3.book_id = T1.book_id WHERE T2.author_name = 'A.J. Ayer'",
"index": 2985,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n last_name text, -- example: ['Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.J. Ayer', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (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\"A.J. Ayer\" is the author_name;\nName the title of books written by author A.J.Ayer.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Free Press', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\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:\nbooks with the most number of pages refers to Max(num_pages); published from 1990 to 2000 refers to SUBSTR(publication_date, 1, 4) BETWEEN '1990' AND '2000'; 'Free Press' is the publisher_name\nName the title of the book with the most number of pages that was published from 1990 to 2000 by publisher Free Press.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Free Press' AND STRFTIME('%Y', T1.publication_date) BETWEEN '1990' AND '2000' ORDER BY T1.num_pages DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Free Press' AND STRFTIME('%Y', T1.publication_date) BETWEEN '1990' AND '2000' ORDER BY T1.num_pages DESC LIMIT 1",
"index": 2986,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Page', 'Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['Free Press', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\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:\nbooks with the most number of pages refers to Max(num_pages); published from 1990 to 2000 refers to SUBSTR(publication_date, 1, 4) BETWEEN '1990' AND '2000'; 'Free Press' is the publisher_name\nName the title of the book with the most number of pages that was published from 1990 to 2000 by publisher Free Press.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_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 street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Servant Leader', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\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\"The Servant Leader\" is the title of the book; book in 2003 refers to SUBSTR(publication_date, 1, 4) = '2003'\nWhat is the order price of the book \"The Servant Leader\" in 2003?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Servant Leader' AND STRFTIME('%Y', T1.publication_date) = '2003'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Servant Leader' AND STRFTIME('%Y', T1.publication_date) = '2003'",
"index": 2987,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_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 street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: ['The Servant Leader', \"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\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\"The Servant Leader\" is the title of the book; book in 2003 refers to SUBSTR(publication_date, 1, 4) = '2003'\nWhat is the order price of the book \"The Servant Leader\" in 2003?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Kandy', 'Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncurrent address refers to address_status = 1; address refers to street_number, street_name, city\nWhat is the current address of customer Kandy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.street_number, T3.street_name, T3.city FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN address_status AS T4 ON T4.status_id = T2.status_id WHERE T1.first_name = 'Kandy'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.street_number, T3.street_name, T3.city FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN address_status AS T4 ON T4.status_id = T2.status_id WHERE T1.first_name = 'Kandy'",
"index": 2988,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Kandy', 'Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncurrent address refers to address_status = 1; address refers to street_number, street_name, city\nWhat is the current address of customer Kandy?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Returned', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_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:\norders got returned refers to status_value = 'Returned'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'\nHow many orders got returned in 2022?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2022'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2022'",
"index": 2989,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Returned', 'Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_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:\norders got returned refers to status_value = 'Returned'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'\nHow many orders got returned in 2022?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['rturbitt2@geocities.jp', 'upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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\"rturbitt2@geocities.jp\" is the email of customer; country refers to country_name\nWhich country does the customer with the email \"rturbitt2@geocities.jp\" from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.country_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN country AS T4 ON T4.country_id = T3.country_id WHERE T1.email = 'rturbitT2@geocities.jp'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T4.country_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN country AS T4 ON T4.country_id = T3.country_id WHERE T1.email = 'rturbitT2@geocities.jp'",
"index": 2990,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['rturbitt2@geocities.jp', 'upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\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\"rturbitt2@geocities.jp\" is the email of customer; country refers to country_name\nWhich country does the customer with the email \"rturbitt2@geocities.jp\" from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['It Books', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished the most books refers to Max(Count(book_id)); publisher refers to publisher_name\nName the publisher who published the most books.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1",
"index": 2991,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['It Books', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n shipping_method_id integer, -- example: [4, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npublished the most books refers to Max(Count(book_id)); publisher refers to publisher_name\nName the publisher who published the most books.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.J. Ayer', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"A.J. Ayer\" is the author_name; first book refers to Min(publication_date)\nWhat is the title of the first book that was written by A.J. Ayer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'A.J. Ayer' ORDER BY T1.publication_date ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'A.J. Ayer' ORDER BY T1.publication_date ASC LIMIT 1",
"index": 2992,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A.J. Ayer', 'A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"A.J. Ayer\" is the author_name; first book refers to Min(publication_date)\nWhat is the title of the first book that was written by A.J. Ayer?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ruthanne', 'Ursola']\n last_name text, -- example: ['Vatini', 'Price', 'Full', 'Purdy']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost greater than $10 refers to price > 10; percentage = Divide (Count(book_id where price >10), Count(book_id)) * 100; full name refers to the composition of first name, lastname\nWhat is the percentage of books that cost greater than $10 and were ordered by customer Ruthanne Vatini?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(SUM(CASE WHEN T1.price > 10 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Ruthanne' AND T3.last_name = 'Vatini'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T1.price > 10 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Ruthanne' AND T3.last_name = 'Vatini'",
"index": 2993,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ruthanne', 'Ursola']\n last_name text, -- example: ['Vatini', 'Price', 'Full', 'Purdy']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n country_name text, -- example: ['Afghanistan', 'Netherlands Antilles']\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n shipping_method_id integer, -- example: [4, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncost greater than $10 refers to price > 10; percentage = Divide (Count(book_id where price >10), Count(book_id)) * 100; full name refers to the composition of first name, lastname\nWhat is the percentage of books that cost greater than $10 and were ordered by customer Ruthanne Vatini?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['AK Press', 'List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_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\"AK Press\" is the publisher_name\nList the title of books published by AK Press.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'AK Press'",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'AK Press'",
"index": 2994,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['AK Press', 'List', '10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (history_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\"AK Press\" is the publisher_name\nList the title of books published by AK Press.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbook with cheapest price refers to Min(price); who order means name of customer which refers to first_name, last_name\nWho ordered the book with the cheapest price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id ORDER BY T1.price ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T3.first_name, T3.last_name FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id ORDER BY T1.price ASC LIMIT 1",
"index": 2995,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Min', 'Ursola', 'Ruthanne']\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n email text, -- example: ['upurdy0@cdbaby.com', 'rvatini1@fema.gov']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_date datetime, -- example: ['2021-07-14 17:04:28', '2020-08-16 20:23:19']\n PRIMARY KEY (history_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbook with cheapest price refers to Min(price); who order means name of customer which refers to first_name, last_name\nWho ordered the book with the cheapest price?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks cost 19 dollars and above refers to price > = 19\nGive the author's name of the books that cost 19 dollars and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN order_line AS T4 ON T4.book_id = T1.book_id WHERE T4.price > 19",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT DISTINCT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN order_line AS T4 ON T4.book_id = T1.book_id WHERE T4.price > 19",
"index": 2996,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n last_name text, -- example: ['Price', 'Purdy', 'Vatini']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n PRIMARY KEY (order_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbooks cost 19 dollars and above refers to price > = 19\nGive the author's name of the books that cost 19 dollars and above.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\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 customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"76092025986\" is the isbn13\nProvide the publisher name of the book with ISBN 76092025986.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.isbn13 = 76092025986",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.isbn13 = 76092025986",
"index": 2997,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\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 customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n street_name text, -- example: ['Glacier Hill Avenue', 'Dottie Junction']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"76092025986\" is the isbn13\nProvide the publisher name of the book with ISBN 76092025986.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"9780763628321\" is the isbn13\nWhat is the price of the book with ISBN 9780763628321?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.isbn13 = 9780763628321",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.isbn13 = 9780763628321",
"index": 2998,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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, -- example: [1, 2]\n first_name text, -- example: ['Ursola', 'Ruthanne']\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n isbn13 text, -- example: ['8987059752', '20049130001']\n language_id integer, -- example: [2, 1]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n order_date datetime, -- example: ['2021-07-14 10:47:19', '2020-08-16 17:26:41']\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n status_value text, -- example: ['Order Received', 'Pending Delivery']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n address_status text, -- example: ['Active', 'Inactive']\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n price real, -- example: [3.19, 1.24]\n PRIMARY KEY (line_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n city text, -- example: ['Torbat-e Jām', 'Beaumont']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (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\"9780763628321\" is the isbn13\nWhat is the price of the book with ISBN 9780763628321?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_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 pages refers to num_pages\nWhat is the number of pages of the book in the order ID 1167?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.num_pages FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.order_id = 1167",
"style": "rule"
} | {
"db_id": "books.sqlite",
"gt_sql": "SELECT T1.num_pages FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.order_id = 1167",
"index": 2999,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE order_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE book (\n book_id integer, -- example: [1, 2]\n title text, -- example: [\"The World's First Love: Mary Mother of \", 'The Illuminati']\n language_id integer, -- example: [2, 1]\n num_pages integer, -- number pages, example: [276, 352]\n publication_date date, -- example: ['1996-09-01', '2004-10-04']\n publisher_id integer, -- example: [1010, 1967]\n PRIMARY KEY (book_id),\n CONSTRAINT fk_book_language_id FOREIGN KEY (language_id) REFERENCES book_language (language_id),\n CONSTRAINT fk_book_publisher_id FOREIGN KEY (publisher_id) REFERENCES publisher (publisher_id)\n);\n\nCREATE TABLE order_history (\n history_id integer, -- example: [1, 2]\n order_id integer, -- example: [1, 2]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (history_id)\n);\n\nCREATE TABLE address (\n address_id integer, -- example: [1, 2]\n street_number text, -- example: ['57', '86']\n country_id integer, -- example: [95, 37]\n PRIMARY KEY (address_id),\n CONSTRAINT fk_address_country_id FOREIGN KEY (country_id) REFERENCES country (country_id)\n);\n\nCREATE TABLE book_language (\n language_id integer, -- example: [1, 2]\n language_code text, -- example: ['eng', 'en-US']\n language_name text, -- example: ['English', 'United States English']\n PRIMARY KEY (language_id)\n);\n\nCREATE TABLE book_author (\n book_id integer, -- example: [1, 2]\n author_id integer, -- example: [1, 2]\n PRIMARY KEY (book_id, author_id),\n CONSTRAINT fk_book_author_book_id FOREIGN KEY (book_id) REFERENCES book (book_id),\n CONSTRAINT fk_book_author_author_id FOREIGN KEY (author_id) REFERENCES author (author_id)\n);\n\nCREATE TABLE address_status (\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (status_id)\n);\n\nCREATE TABLE author (\n author_id integer, -- example: [1, 2]\n author_name text, -- example: ['A. Bartlett Giamatti', 'A. Elizabeth Delany']\n PRIMARY KEY (author_id)\n);\n\nCREATE TABLE country (\n country_id integer, -- example: [1, 2]\n PRIMARY KEY (country_id)\n);\n\nCREATE TABLE shipping_method (\n method_id integer, -- example: [1, 2]\n method_name text, -- example: ['Standard', 'Priority']\n cost real, -- example: [5.9, 8.9]\n PRIMARY KEY (method_id)\n);\n\nCREATE TABLE customer_address (\n customer_id integer, -- example: [1, 2]\n address_id integer, -- example: [606, 266]\n status_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id, address_id),\n CONSTRAINT fk_customer_address_customer_id FOREIGN KEY (customer_id) REFERENCES customer (customer_id),\n CONSTRAINT fk_customer_address_address_id FOREIGN KEY (address_id) REFERENCES address (address_id)\n);\n\nCREATE TABLE cust_order (\n order_id integer, -- example: [1, 2]\n customer_id integer, -- example: [387, 1256]\n dest_address_id integer, -- destination address id, example: [1, 2]\n PRIMARY KEY (order_id)\n);\n\nCREATE TABLE customer (\n customer_id integer, -- example: [1, 2]\n PRIMARY KEY (customer_id)\n);\n\nCREATE TABLE publisher (\n publisher_id integer, -- example: [1, 2]\n publisher_name text, -- example: ['10/18', '1st Book Library']\n PRIMARY KEY (publisher_id)\n);\n\nCREATE TABLE order_line (\n line_id integer, -- example: [1024, 1025]\n order_id integer, -- example: [2051, 899]\n book_id integer, -- example: [10720, 10105]\n PRIMARY KEY (line_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 pages refers to num_pages\nWhat is the number of pages of the book in the order ID 1167?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.