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 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 order_history (\n history_id integer, -- example: [1, 2]\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 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 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 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_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['British English', '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: ['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 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 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\"British English\" is the language_name of the book\nProvide the title of the books published 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 DISTINCT 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 DISTINCT 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": 3000,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 order_history (\n history_id integer, -- example: [1, 2]\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 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 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 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_language (\n language_id integer, -- example: [1, 2]\n language_name text, -- example: ['British English', '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: ['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 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 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\"British English\" is the language_name of the book\nProvide the title of the books published 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 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 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 PRIMARY KEY (status_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 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 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 (\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 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 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: ['Brava', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Brava\" is the publisher_name; in 2006 refers to SUBSTR(publication_date, 1, 4) = '2006'\nHow many books were published by Brava in 2006?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Brava' AND STRFTIME('%Y', T1.publication_date) = '2006'",
"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 = 'Brava' AND STRFTIME('%Y', T1.publication_date) = '2006'",
"index": 3001,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 PRIMARY KEY (status_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 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 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 (\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 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 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: ['Brava', '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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Brava\" is the publisher_name; in 2006 refers to SUBSTR(publication_date, 1, 4) = '2006'\nHow many books were published by Brava in 2006?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE 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 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 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 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 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 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: ['Zorro', \"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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Zorro\" is the title of the book; langauge refers to language_name\nWhat is the language of the book titled Zorro?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title = 'Zorro'",
"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.title = 'Zorro'",
"index": 3002,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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 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 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 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 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 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: ['Zorro', \"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_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);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n\"Zorro\" is the title of the book; langauge refers to language_name\nWhat is the language of the book titled Zorro?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Alan Lee', '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 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_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: ['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 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 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 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 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 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_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 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 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\"Alan Lee\" is the author_name; publisher's name refers to publisher_name\nGive the publisher's name of the books authored by Alan Lee.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 = 'Alan Lee' GROUP BY T4.publisher_name",
"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 = 'Alan Lee' GROUP BY T4.publisher_name",
"index": 3003,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task 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: ['Alan Lee', '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 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_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: ['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 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 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 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 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 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_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 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 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\"Alan Lee\" is the author_name; publisher's name refers to publisher_name\nGive the publisher's name of the books authored by Alan Lee.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Joshua', 'Anastasia']\n last_name text, -- example: ['Rosa', 'Hansen']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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 2010 refers to inspection_date like '2010%'\nHow many inspections were sanitarian Joshua Rosa responsible for in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.inspection_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.inspection_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'",
"index": 3004,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Joshua', 'Anastasia']\n last_name text, -- example: ['Rosa', 'Hansen']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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 2010 refers to inspection_date like '2010%'\nHow many inspections were sanitarian Joshua Rosa responsible for in 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Cafeteria', 'cafeteria', 'CAFETERIA', 'Special Event']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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 2010 refers to inspection_date like '2010%'; restaurant or cafeteria refers to facility_type = 'Restaurant'\nAmong the facilities that have undergone at least one inspection in 2010, how many of them are restaurants or cafeterias?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.facility_type = 'Restaurant'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.facility_type = 'Restaurant'",
"index": 3005,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Cafeteria', 'cafeteria', 'CAFETERIA', 'Special Event']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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 2010 refers to inspection_date like '2010%'; restaurant or cafeteria refers to facility_type = 'Restaurant'\nAmong the facilities that have undergone at least one inspection in 2010, how many of them are restaurants or cafeterias?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-05-11', '2010-05-14', '2010-05-10', '2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation coordinates refers to latitude, longitude; on 2010/5/11 refers to inspection_date = '2010-05-11'\nPlease list the location coordinates of all the facilities that had an inspection on 2010/5/11.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.latitude, T2.longitude FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.inspection_date = '2010-05-11'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.latitude, T2.longitude FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.inspection_date = '2010-05-11'",
"index": 3006,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-05-11', '2010-05-14', '2010-05-10', '2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlocation coordinates refers to latitude, longitude; on 2010/5/11 refers to inspection_date = '2010-05-11'\nPlease list the location coordinates of all the facilities that had an inspection on 2010/5/11.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2010 refers to inspection_date like '2010%'; in ward no.42 refers to ward = 42\nAmong the facilities that have undergone at least one inspection in 2010, how many of them are in ward no.42?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.ward = 42",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.ward = 42",
"index": 3007,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin 2010 refers to inspection_date like '2010%'; in ward no.42 refers to ward = 42\nAmong the facilities that have undergone at least one inspection in 2010, how many of them are in ward no.42?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Burbank', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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 facility Burbank refers to dba_name = 'Burbank'\nPlease list the full names of all the sanitarians who have inspected the facility Burbank.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T3.dba_name = 'Burbank' AND T1.title = 'Sanitarian'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T3.dba_name = 'Burbank' AND T1.title = 'Sanitarian'",
"index": 3008,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Burbank', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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 facility Burbank refers to dba_name = 'Burbank'\nPlease list the full names of all the sanitarians who have inspected the facility Burbank.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nassumed name refers to dba_name; failed an inspection refers to results = 'Fail'; in 2010 refers to inspection_date like '2010%'\nPlease list the assumed name of all the facilities that failed an inspection in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.results = 'Fail' AND strftime('%Y', T1.inspection_date) = '2010'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.results = 'Fail' AND strftime('%Y', T1.inspection_date) = '2010'",
"index": 3009,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nassumed name refers to dba_name; failed an inspection refers to results = 'Fail'; in 2010 refers to inspection_date like '2010%'\nPlease list the assumed name of all the facilities that failed an inspection in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['AMUNDSEN HIGH SCHOOL', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-05-11', '2010-05-14', '2010-05-10', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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; Amundsen High School refers to dba_name = 'AMUNDSEN HIGH SCHOOL'; on 2010/5/11 refers to inspection_date = '2010-05-11'\nWhat is the full name of the sanitarian who inspected Amundsen High School on 2010/5/11?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T2.inspection_date = '2010-05-11' AND T3.dba_name = 'AMUNDSEN HIGH SCHOOL' AND T1.title = 'Sanitarian'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T2.inspection_date = '2010-05-11' AND T3.dba_name = 'AMUNDSEN HIGH SCHOOL' AND T1.title = 'Sanitarian'",
"index": 3010,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['AMUNDSEN HIGH SCHOOL', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-05-11', '2010-05-14', '2010-05-10', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_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; Amundsen High School refers to dba_name = 'AMUNDSEN HIGH SCHOOL'; on 2010/5/11 refers to inspection_date = '2010-05-11'\nWhat is the full name of the sanitarian who inspected Amundsen High School on 2010/5/11?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-21', '2010-01-05']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Azha Restaurant Inc.', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['Azha Restaurant', 'COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAzha Restaurant Inc. refers to dba_name = 'Azha Restaurant Inc.'; on 2010/1/21 refers to inspection_date = '2010-01-21'; follow-up inspection date refers to followup_to\nAfter Azha Restaurant Inc. passed the inspection on 2010/1/21, when was the follow-up inspection done?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.followup_to FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T2.dba_name = 'Azha Restaurant Inc.' AND T1.results = 'Pass' AND T1.inspection_date = '2010-01-21'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.followup_to FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T2.dba_name = 'Azha Restaurant Inc.' AND T1.results = 'Pass' AND T1.inspection_date = '2010-01-21'",
"index": 3011,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-21', '2010-01-05']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Azha Restaurant Inc.', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['Azha Restaurant', 'COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAzha Restaurant Inc. refers to dba_name = 'Azha Restaurant Inc.'; on 2010/1/21 refers to inspection_date = '2010-01-21'; follow-up inspection date refers to followup_to\nAfter Azha Restaurant Inc. passed the inspection on 2010/1/21, when was the follow-up inspection done?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_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 the year 2010 refers to inspection_date like '2010%'; salary is over 70000 refers to salary > 70000; average number = divide(sum(inspection where inspection_date like '2010%'), sum(employee_id where salary > 70000))\nWhat is the average number of inspections carried out in the year 2010 by a sanitarian whose salary is over 70000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_date LIKE '2010%' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.salary > 70000 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.inspection_date LIKE '2010%' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.salary > 70000 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id",
"index": 3012,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_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 the year 2010 refers to inspection_date like '2010%'; salary is over 70000 refers to salary > 70000; average number = divide(sum(inspection where inspection_date like '2010%'), sum(employee_id where salary > 70000))\nWhat is the average number of inspections carried out in the year 2010 by a sanitarian whose salary is over 70000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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\"Refrigeration and metal stem thermometers provided and conspicuous\" refers to Description = 'Refrigeration and metal stem thermometers provided and conspicuous '\nWhat is the point level of \"Refrigeration and metal stem thermometers provided and conspicuous\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous '",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous '",
"index": 3013,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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\"Refrigeration and metal stem thermometers provided and conspicuous\" refers to Description = 'Refrigeration and metal stem thermometers provided and conspicuous '\nWhat is the point level of \"Refrigeration and metal stem thermometers provided and conspicuous\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['All Style Buffet', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAll Style Buffet refers to dba_name = 'All Style Buffet'; Restaurant refers to facility_type = 'Restaurant'\nHow many inspections did All Style Buffet Restaurant have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'Restaurant' AND T1.dba_name = 'All Style Buffet'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'Restaurant' AND T1.dba_name = 'All Style Buffet'",
"index": 3014,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['All Style Buffet', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAll Style Buffet refers to dba_name = 'All Style Buffet'; Restaurant refers to facility_type = 'Restaurant'\nHow many inspections did All Style Buffet Restaurant 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 employee (\n employee_id integer, -- example: [103705, 104633]\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n city text, -- example: ['CHICAGO', 'Chicago']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2015-05-08', '2015-05-06', '2015-05-07', '2015-05-05', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to facility_type = 'Restaurant'; on 2015/5/8 refers to inspection_date = '2015-05-08'\nHow many restaurants were inspected on 2015/5/8?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_date = '2015-05-08' AND T1.facility_type = 'Restaurant'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_date = '2015-05-08' AND T1.facility_type = 'Restaurant'",
"index": 3015,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n city text, -- example: ['CHICAGO', 'Chicago']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2015-05-08', '2015-05-06', '2015-05-07', '2015-05-05', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to facility_type = 'Restaurant'; on 2015/5/8 refers to inspection_date = '2015-05-08'\nHow many restaurants were inspected on 2015/5/8?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Maintenance', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n city text, -- example: ['CHICAGO', 'Chicago']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_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\"food maintenance\" related refers to category = 'Food Maintenance'; inspection no.1454071 refers to inspection_id = '1454071'\nHow many \"food maintenance\" related violations did inspection no.1454071 have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.point_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = '1454071' AND T1.category = 'Food Maintenance'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.point_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = '1454071' AND T1.category = 'Food Maintenance'",
"index": 3016,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Maintenance', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n city text, -- example: ['CHICAGO', 'Chicago']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_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\"food maintenance\" related refers to category = 'Food Maintenance'; inspection no.1454071 refers to inspection_id = '1454071'\nHow many \"food maintenance\" related violations did inspection no.1454071 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 inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Grocery Store', 'GROCERY', 'grocery', 'STORE', 'Special Event', 'Restaurant']\n address text, -- example: ['3635 W DIVERSEY AVE ', '118 N CENTRAL AVE ', '230 W MONROE ST ']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngrocery store refers to facility_type = 'Grocery Store'; \"3635 W DIVERSEY AVE\" refers to address = '3635 W DIVERSEY AVE'\nFor the grocery store located at \"3635 W DIVERSEY AVE\", how many inspections did it have?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.address = '3635 W DIVERSEY AVE ' AND T1.facility_type = 'Grocery Store'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.address = '3635 W DIVERSEY AVE ' AND T1.facility_type = 'Grocery Store'",
"index": 3017,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Grocery Store', 'GROCERY', 'grocery', 'STORE', 'Special Event', 'Restaurant']\n address text, -- example: ['3635 W DIVERSEY AVE ', '118 N CENTRAL AVE ', '230 W MONROE ST ']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngrocery store refers to facility_type = 'Grocery Store'; \"3635 W DIVERSEY AVE\" refers to address = '3635 W DIVERSEY AVE'\nFor the grocery store located at \"3635 W DIVERSEY AVE\", how many inspections did it 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 inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Out of Business', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Lisa', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Tillman', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe result of \"Out of Business\" refers to results = 'Out of Business'\nHow many inspections done by Lisa Tillman ended up with the result of \"Out of Business\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.first_name = 'Lisa' AND T2.last_name = 'Tillman' AND T1.results = 'Out of Business'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.first_name = 'Lisa' AND T2.last_name = 'Tillman' AND T1.results = 'Out of Business'",
"index": 3018,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Out of Business', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Lisa', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Tillman', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe result of \"Out of Business\" refers to results = 'Out of Business'\nHow many inspections done by Lisa Tillman ended up with the result of \"Out of Business\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['5000 N Wolcott Ave', '6023 S Elizabeth St']\n city text, -- example: ['Chicago', 'Park Forest']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2011-06-01', '2011-06-06', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['N', 'COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsanitarian refers to title = 'Sanitarian'; 5000 N Wolcott Ave refers to address = '5000 N Wolcott Ave'; in May 2011 refers to inspection_date between '2011-04-30' and '2011-06-01'\nFor the sanitarian who lives on 5000 N Wolcott Ave, how many establishments did he/she inspect in the May of 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.address = '5000 N Wolcott Ave' AND T2.title = 'Sanitarian' AND strftime('%Y-%m', T1.inspection_date) = '2011-05'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.address = '5000 N Wolcott Ave' AND T2.title = 'Sanitarian' AND strftime('%Y-%m', T1.inspection_date) = '2011-05'",
"index": 3019,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['5000 N Wolcott Ave', '6023 S Elizabeth St']\n city text, -- example: ['Chicago', 'Park Forest']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2011-06-01', '2011-06-06', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['N', 'COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsanitarian refers to title = 'Sanitarian'; 5000 N Wolcott Ave refers to address = '5000 N Wolcott Ave'; in May 2011 refers to inspection_date between '2011-04-30' and '2011-06-01'\nFor the sanitarian who lives on 5000 N Wolcott Ave, how many establishments did he/she inspect in the May of 2011?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsanitarian refers to title = 'Sanitarian'; in Chicago refers to city = 'Chicago'; zip code 60617 refers to zip = 60617\nHow many sanitarian employees in Chicago are from the zip code 60617?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(employee_id) FROM employee WHERE zip = '60617'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(employee_id) FROM employee WHERE zip = '60617'",
"index": 3020,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsanitarian refers to title = 'Sanitarian'; in Chicago refers to city = 'Chicago'; zip code 60617 refers to zip = 60617\nHow many sanitarian employees in Chicago are from the zip code 60617?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n PRIMARY KEY (point_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 lowest salary refers to min(salary)\nWhat is the full name of the employee with the lowest salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee ORDER BY salary ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT first_name, last_name FROM employee ORDER BY salary ASC LIMIT 1",
"index": 3021,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n PRIMARY KEY (point_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 lowest salary refers to min(salary)\nWhat is the full name of the employee with the lowest salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HOMEMADE PIZZA', 'Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHomemade Pizza refers to dba_name = 'HOMEMADE PIZZA'; a risk level of 2 refers to risk_level = 2\nHow many establishments that are doing business as Homemade Pizza have a risk level of 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(license_no) FROM establishment WHERE risk_level = 2 AND dba_name = 'HOMEMADE PIZZA'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(license_no) FROM establishment WHERE risk_level = 2 AND dba_name = 'HOMEMADE PIZZA'",
"index": 3022,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HOMEMADE PIZZA', 'Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHomemade Pizza refers to dba_name = 'HOMEMADE PIZZA'; a risk level of 2 refers to risk_level = 2\nHow many establishments that are doing business as Homemade Pizza have a risk level of 2?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: [\"RENALDI'S PIZZA\", 'HARVEST CRUSADES MINISTRIES', 'COSI']\n risk_level integer, -- example: [2, 1]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRenaldi's Pizza refers to dba_name = 'RENALDI''S PIZZA'; first inspection refers to min(inspection_date)\nWhen did Renaldi's Pizza had its first inspection?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MIN(T2.inspection_date) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'RENALDI''S PIZZA'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT MIN(T2.inspection_date) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'RENALDI''S PIZZA'",
"index": 3023,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: [\"RENALDI'S PIZZA\", 'HARVEST CRUSADES MINISTRIES', 'COSI']\n risk_level integer, -- example: [2, 1]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nRenaldi's Pizza refers to dba_name = 'RENALDI''S PIZZA'; first inspection refers to min(inspection_date)\nWhen did Renaldi's Pizza had its first inspection?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass w/ Conditions', 'Pass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 business refers to dba_name; passed with conditions refers to results = 'Pass w/ Conditions'; in May 2012 refers to inspection_date like '2012-05%'\nWhat are the names of the businesses that passed with conditions in May 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T1.inspection_date) = '2012-05' AND T1.results = 'Pass w/ Conditions'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T1.inspection_date) = '2012-05' AND T1.results = 'Pass w/ Conditions'",
"index": 3024,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass w/ Conditions', 'Pass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 business refers to dba_name; passed with conditions refers to results = 'Pass w/ Conditions'; in May 2012 refers to inspection_date like '2012-05%'\nWhat are the names of the businesses that passed with conditions in May 2012?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['David', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Hodges', 'David', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Short Form Complaint', 'Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort form complaint inspection refers to inspection_type = 'Short Form Complaint'; pass refers to results = 'Pass'\nOut of all the short form complaint inspections done by David Hodges, how many businesses passed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.license_no) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'David' AND T1.last_name = 'Hodges' AND T1.employee_id = 153225 AND T2.inspection_type = 'Short Form Complaint' AND T2.results = 'Pass'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.license_no) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'David' AND T1.last_name = 'Hodges' AND T1.employee_id = 153225 AND T2.inspection_type = 'Short Form Complaint' AND T2.results = 'Pass'",
"index": 3025,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['David', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Hodges', 'David', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Short Form Complaint', 'Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nshort form complaint inspection refers to inspection_type = 'Short Form Complaint'; pass refers to results = 'Pass'\nOut of all the short form complaint inspections done by David Hodges, how many businesses passed?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest number of inspections done refers to max(count(employee_id))\nHow much is the salary of the employee who has the highest number of inspections done 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.salary FROM employee AS T1 INNER JOIN ( SELECT employee_id, COUNT(inspection_id) FROM inspection GROUP BY employee_id ORDER BY COUNT(inspection_id) DESC LIMIT 1 ) AS T2 ON T1.employee_id = T2.employee_id",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.salary FROM employee AS T1 INNER JOIN ( SELECT employee_id, COUNT(inspection_id) FROM inspection GROUP BY employee_id ORDER BY COUNT(inspection_id) DESC LIMIT 1 ) AS T2 ON T1.employee_id = T2.employee_id",
"index": 3026,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest number of inspections done refers to max(count(employee_id))\nHow much is the salary of the employee who has the highest number of inspections done 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 inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location refers to latitude, longitude; the highest number of failed inspections refers to max(count(results where results = 'Fail'))\nWhat is the precise location of the establishment with the highest number of failed inspections?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.latitude, T1.longitude FROM establishment AS T1 INNER JOIN ( SELECT license_no FROM inspection WHERE results = 'Fail' GROUP BY license_no ORDER BY COUNT(results) DESC LIMIT 1 ) AS T2 ON T1.license_no = T2.license_no",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.latitude, T1.longitude FROM establishment AS T1 INNER JOIN ( SELECT license_no FROM inspection WHERE results = 'Fail' GROUP BY license_no ORDER BY COUNT(results) DESC LIMIT 1 ) AS T2 ON T1.license_no = T2.license_no",
"index": 3027,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nprecise location refers to latitude, longitude; the highest number of failed inspections refers to max(count(results where results = 'Fail'))\nWhat is the precise location of the establishment with the highest number of failed inspections?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['RON OF JAPAN INC', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 fine = sum(fine); Ron of Japan Inc refers to dba_name = 'RON OF JAPAN INC'; on February 2014 refers to inspection_date like '2014-02%'\nHow much is the total fine given to Ron of Japan Inc in its inspection done on February 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T3.fine) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE strftime('%Y-%m', T2.inspection_date) = '2014-02' AND T1.dba_name = 'RON OF JAPAN INC'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT SUM(T3.fine) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE strftime('%Y-%m', T2.inspection_date) = '2014-02' AND T1.dba_name = 'RON OF JAPAN INC'",
"index": 3028,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['RON OF JAPAN INC', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 fine = sum(fine); Ron of Japan Inc refers to dba_name = 'RON OF JAPAN INC'; on February 2014 refers to inspection_date like '2014-02%'\nHow much is the total fine given to Ron of Japan Inc in its inspection done on February 2014?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 highest amount of fine refers to max(sum(fine))\nWhat is the full name of the employee who gave the highest amount of fine of all time?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, SUM(T3.fine) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id GROUP BY T1.first_name, T1.last_name ORDER BY SUM(T3.fine) DESC LIMIT 1 ) t",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, SUM(T3.fine) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id GROUP BY T1.first_name, T1.last_name ORDER BY SUM(T3.fine) DESC LIMIT 1 ) t",
"index": 3029,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 highest amount of fine refers to max(sum(fine))\nWhat is the full name of the employee who gave the highest amount of fine 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 establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['6501 S HERMITAGE AVE ', '118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['7211 S Hermitage Ave', '6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n7211 S Hermitage Ave refers to address = '7211 S Hermitage Ave'; Chicago refers to city = 'Chicago'; IL refers to state = 'IL'\nWhat is the employee's last name at 7211 S Hermitage Ave, Chicago, IL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT last_name FROM employee WHERE address = '7211 S Hermitage Ave' AND city = 'Chicago' AND state = 'IL'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT last_name FROM employee WHERE address = '7211 S Hermitage Ave' AND city = 'Chicago' AND state = 'IL'",
"index": 3030,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['6501 S HERMITAGE AVE ', '118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['7211 S Hermitage Ave', '6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n7211 S Hermitage Ave refers to address = '7211 S Hermitage Ave'; Chicago refers to city = 'Chicago'; IL refers to state = 'IL'\nWhat is the employee's last name at 7211 S Hermitage Ave, Chicago, IL?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-05-05', '2010-05-06', '2010-05-07', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishment's name refers to dba_name; employee name refers to first_name, last_name; inspection ID 44256 refers to inspection_id = 44256; on May 5, 2010 refers to inspection_date = '2010-05-05'\nWhat is the establishment's name and employee involved in the inspection ID 44256 on May 5, 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.dba_name, T3.first_name, T3.last_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T2.inspection_date = '2010-05-05' AND T2.inspection_id = 44256",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.dba_name, T3.first_name, T3.last_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T2.inspection_date = '2010-05-05' AND T2.inspection_id = 44256",
"index": 3031,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-05-05', '2010-05-06', '2010-05-07', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nestablishment's name refers to dba_name; employee name refers to first_name, last_name; inspection ID 44256 refers to inspection_id = 44256; on May 5, 2010 refers to inspection_date = '2010-05-05'\nWhat is the establishment's name and employee involved in the inspection ID 44256 on May 5, 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-03-09', '2010-03-02', '2010-03-03', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['CANVASS', 'Canvass', 'Complaint']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_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; canvass inspection type refers to inspection_type = 'Canvass'; on March 09, 2010 refers to inspection_date = '2010-03-09'\nWhat is the employee's full name involved in the canvass inspection type on March 09, 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-03-09' AND T2.inspection_type = 'Canvass'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-03-09' AND T2.inspection_type = 'Canvass'",
"index": 3032,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-03-09', '2010-03-02', '2010-03-03', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['CANVASS', 'Canvass', 'Complaint']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_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; canvass inspection type refers to inspection_type = 'Canvass'; on March 09, 2010 refers to inspection_date = '2010-03-09'\nWhat is the employee's full name involved in the canvass inspection type on March 09, 2010?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['PIZZA RUSTICA, INC', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_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\"PIZZA RUSTICA, INC.\" refers to dba_name = 'PIZZA RUSTICA, INC'\nProvide the inspection ID of the establishment named \"PIZZA RUSTICA, INC.\"\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'PIZZA RUSTICA, INC'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'PIZZA RUSTICA, INC'",
"index": 3033,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['PIZZA RUSTICA, INC', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_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\"PIZZA RUSTICA, INC.\" refers to dba_name = 'PIZZA RUSTICA, INC'\nProvide the inspection ID of the establishment named \"PIZZA RUSTICA, INC.\"\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Display of Inspection Report Summary', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to first_name, last_name; Display of Inspection Report Summary category refers to category = 'Display of Inspection Report Summary'\nList the names of employees involved in an inspection with the Display of Inspection Report Summary category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'Display of Inspection Report Summary'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'Display of Inspection Report Summary'",
"index": 3034,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Display of Inspection Report Summary', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to first_name, last_name; Display of Inspection Report Summary category refers to category = 'Display of Inspection Report Summary'\nList the names of employees involved in an inspection with the Display of Inspection Report Summary category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n risk_level integer, -- example: [2, 1]\n state text, -- example: ['IL']\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to facility_type = 'Restaurant'; the lowest risk level refers to min(risk_level); failed refers to results = 'Fail'; the complaint inspection type refers to inspection_type = 'Complaint'\nHow many of the restaurants with the lowest risk level failed the complaint inspection type?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = '1' AND T2.inspection_type = 'Complaint' AND T1.facility_type = 'Restaurant' AND T2.results = 'Fail'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = '1' AND T2.inspection_type = 'Complaint' AND T1.facility_type = 'Restaurant' AND T2.results = 'Fail'",
"index": 3035,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n risk_level integer, -- example: [2, 1]\n state text, -- example: ['IL']\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to facility_type = 'Restaurant'; the lowest risk level refers to min(risk_level); failed refers to results = 'Fail'; the complaint inspection type refers to inspection_type = 'Complaint'\nHow many of the restaurants with the lowest risk level failed the complaint inspection type?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['PROVIDED', 'All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_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 state, city, address\nProvide the fine paid and the complete address of the establishment with inspection ID 48216.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.fine, T1.state, T1.city, T1.address FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T2.inspection_id = 48216",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T3.fine, T1.state, T1.city, T1.address FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T2.inspection_id = 48216",
"index": 3036,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['PROVIDED', 'All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_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 state, city, address\nProvide the fine paid and the complete address of the establishment with inspection ID 48216.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n state text, -- example: ['IL']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection description refers to Description; inspector's comment refers to inspector_comment\nWhat are the inspection description and inspector's comments in the inspection ID 164795?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Description, T2.inspector_comment FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = 44247",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.Description, T2.inspector_comment FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = 44247",
"index": 3037,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n state text, -- example: ['IL']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection description refers to Description; inspector's comment refers to inspector_comment\nWhat are the inspection description and inspector's comments in the inspection ID 164795?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspector's comment refers to inspector_comment; clean operating requirement code refers to code\nWhat are the inspector's comments and clean operating requirement code for inspection ID 54216 and point ID 34?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspector_comment, T1.code FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = 54216 AND T2.point_id = 34",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T2.inspector_comment, T1.code FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = 54216 AND T2.point_id = 34",
"index": 3038,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspector's comment refers to inspector_comment; clean operating requirement code refers to code\nWhat are the inspector's comments and clean operating requirement code for inspection ID 54216 and point ID 34?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfine for a minor food safety problem refers to fine = 100; percentage = divide(count(inspection_id where fine = 100), sum(inspection_id)) * 100%\nCalculate the percentage of inspections with the fine for a minor food safety problem.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN fine = 100 THEN inspection_id END) AS REAL) * 100 / COUNT(inspection_id) FROM violation",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN fine = 100 THEN inspection_id END) AS REAL) * 100 / COUNT(inspection_id) FROM violation",
"index": 3039,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfine for a minor food safety problem refers to fine = 100; percentage = divide(count(inspection_id where fine = 100), sum(inspection_id)) * 100%\nCalculate the percentage of inspections with the fine for a minor food safety problem.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['THE POINT', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-08-07', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 7th August 2010 refers to inspection_date = '2010-08-07'\nList the point IDs and fines of the inspections done on 7th August 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.point_id, T2.fine FROM inspection AS T1 INNER JOIN violation AS T2 ON T1.inspection_id = T2.inspection_id WHERE T1.inspection_date = '2010-08-07'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T2.point_id, T2.fine FROM inspection AS T1 INNER JOIN violation AS T2 ON T1.inspection_id = T2.inspection_id WHERE T1.inspection_date = '2010-08-07'",
"index": 3040,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['THE POINT', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-08-07', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\non 7th August 2010 refers to inspection_date = '2010-08-07'\nList the point IDs and fines of the inspections done on 7th August 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n state text, -- example: ['IL']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Display of Inspection Report Summary', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 the display of inspection report summary category refers to category = 'Display of Inspection Report Summary'\nHow many inspections were done under the display of inspection report summary category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Display of Inspection Report Summary'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Display of Inspection Report Summary'",
"index": 3041,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n state text, -- example: ['IL']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Display of Inspection Report Summary', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 the display of inspection report summary category refers to category = 'Display of Inspection Report Summary'\nHow many inspections were done under the display of inspection report summary category?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['RIVERWALK CAFE', 'RIVERWALK', 'CAFE', 'Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype refers to inspection_type; Riverwalk café refers to facility_type = 'RIVERWALK CAFE'\nList the types and results of the inspections done on Riverwalk café.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_type, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'RIVERWALK CAFE'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T2.inspection_type, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'RIVERWALK CAFE'",
"index": 3042,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['RIVERWALK CAFE', 'RIVERWALK', 'CAFE', 'Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype refers to inspection_type; Riverwalk café refers to facility_type = 'RIVERWALK CAFE'\nList the types and results of the inspections done on Riverwalk café.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['JEAN SAMOCKI', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee's name refers to first_name, last_name; Jean Samocki refers to dba_name = 'JEAN SAMOCKI'\nWho inspected Jean Samocki and what was the result?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T1.dba_name = 'JEAN SAMOCKI'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T3.first_name, T3.last_name, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T1.dba_name = 'JEAN SAMOCKI'",
"index": 3043,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['JEAN SAMOCKI', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee's name refers to first_name, last_name; Jean Samocki refers to dba_name = 'JEAN SAMOCKI'\nWho inspected Jean Samocki and what was the result?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Equipment and Utensil', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 the food equipment and utensil category refers to category = 'Food Equipment and Utensil'\nCalculate the total amount of fine under the food equipment and utensil category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.fine) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Food Equipment and Utensil'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT SUM(T2.fine) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Food Equipment and Utensil'",
"index": 3044,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Equipment and Utensil', 'Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 the food equipment and utensil category refers to category = 'Food Equipment and Utensil'\nCalculate the total amount of fine under the food equipment and utensil category.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nverified quality refers to results like 'Pass%'; from Chicago refers to city = 'CHICAGO'; percentage = divide(count(inspection_id where results like 'Pass%'), sum(inspection_id)) * 100%\nCalculate the percentage of inspections with verified quality. Among them, how many businesses were from Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T2.results LIKE '%Pass%' THEN T2.inspection_id END) AS REAL) * 100 / COUNT(T2.inspection_id), COUNT(DISTINCT T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.city = 'CHICAGO'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T2.results LIKE '%Pass%' THEN T2.inspection_id END) AS REAL) * 100 / COUNT(T2.inspection_id), COUNT(DISTINCT T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.city = 'CHICAGO'",
"index": 3045,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nverified quality refers to results like 'Pass%'; from Chicago refers to city = 'CHICAGO'; percentage = divide(count(inspection_id where results like 'Pass%'), sum(inspection_id)) * 100%\nCalculate the percentage of inspections with verified quality. Among them, how many businesses were from Chicago?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anthony', 'Jessica', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Anthony', 'Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-08', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 2010 to 2017 refers to inspection_date > '2010-01-01' AND T2.inspection_id < '2017-12-31'; average inspections per year = divide(count(inspection_id where inspection_date > '2010-01-01' AND T2.inspection_id < '2017-12-31'), 8)\nCalculate the average inspections per year done by Jessica Anthony from 2010 to 2017.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T1.first_name = 'Jessica' AND T1.last_name = 'Anthony' THEN T2.inspection_id ELSE 0 END) AS REAL) / 8 FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) BETWEEN '2010' AND '2017'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.first_name = 'Jessica' AND T1.last_name = 'Anthony' THEN T2.inspection_id ELSE 0 END) AS REAL) / 8 FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) BETWEEN '2010' AND '2017'",
"index": 3046,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anthony', 'Jessica', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Anthony', 'Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-08', '2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfrom 2010 to 2017 refers to inspection_date > '2010-01-01' AND T2.inspection_id < '2017-12-31'; average inspections per year = divide(count(inspection_id where inspection_date > '2010-01-01' AND T2.inspection_id < '2017-12-31'), 8)\nCalculate the average inspections per year done by Jessica Anthony from 2010 to 2017.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWrite down the last name of employee who did inspection ID 52238?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52238",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52238",
"index": 3047,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nWrite down the last name of employee who did inspection ID 52238?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Thomas', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Langley', 'Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection result refers to results\nWhat is the inspection result for inspection done by Thomas Langley?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Thomas' AND T1.last_name = 'Langley'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Thomas' AND T1.last_name = 'Langley'",
"index": 3048,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Thomas', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Langley', 'Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection result refers to results\nWhat is the inspection result for inspection done by Thomas Langley?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['CANVASS', 'Canvass', 'Complaint']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nphone number refers to phone; Canvass inspection refers to inspection_type = 'Canvass'\nList down the phone numbers of employees who did Canvass inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.phone FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_type = 'Canvass'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.phone FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_type = 'Canvass'",
"index": 3049,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['CANVASS', 'Canvass', 'Complaint']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nphone number refers to phone; Canvass inspection refers to inspection_type = 'Canvass'\nList down the phone numbers of employees who did Canvass inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njob title refers to title\nWhat is the job title of employee who did inspection ID 52269?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52269",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52269",
"index": 3050,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njob title refers to title\nWhat is the job title of employee who did inspection ID 52269?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['JOHN SCHALLER', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of inspection refers to inspection_type; John Schaller refers to dba_name = 'JOHN SCHALLER'\nWhat type of inspection was done at John Schaller?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_type FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'JOHN SCHALLER'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.inspection_type FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'JOHN SCHALLER'",
"index": 3051,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['JOHN SCHALLER', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype of inspection refers to inspection_type; John Schaller refers to dba_name = 'JOHN SCHALLER'\nWhat type of inspection was done at John Schaller?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n risk_level integer, -- example: [2, 1]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Serious ', 'Critical']\n PRIMARY KEY (point_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 2010 refers to inspection_date like '2010%'; had serious food safety issue refers to risk_level = 3\nHow many inspections done in 2010 had serious food safety issue?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.risk_level = 3",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.risk_level = 3",
"index": 3052,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n risk_level integer, -- example: [2, 1]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Serious ', 'Critical']\n PRIMARY KEY (point_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 2010 refers to inspection_date like '2010%'; had serious food safety issue refers to risk_level = 3\nHow many inspections done in 2010 had serious food safety issue?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection from ID 52270 to 52272 refers to inspection_id between 52270 and 52272\nCalculate the total salary for employees who did inspection from ID 52270 to 52272.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.salary) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_id BETWEEN 52270 AND 52272",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT SUM(T2.salary) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_id BETWEEN 52270 AND 52272",
"index": 3053,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection from ID 52270 to 52272 refers to inspection_id between 52270 and 52272\nCalculate the total salary for employees who did inspection from ID 52270 to 52272.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['License Re-Inspection', 'LICENSE', 'license', 'License', 'Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection on License Re-Inspection refers to inspection_type = 'License Re-Inspection'; average salary = avg(salary)\nCalculate the average salary for employees who did inspection on License Re-Inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT AVG(T2.salary) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_type = 'License Re-Inspection'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT AVG(T2.salary) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_type = 'License Re-Inspection'",
"index": 3054,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['License Re-Inspection', 'LICENSE', 'license', 'License', 'Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ninspection on License Re-Inspection refers to inspection_type = 'License Re-Inspection'; average salary = avg(salary)\nCalculate the average salary for employees who did inspection on License Re-Inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['LICENSE', 'license', 'License', 'Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlicense number 1222441 refers to license_no = 1222441; result of the inspection refers to results; zip code number refers to zip\nDid license number 1222441 pass the inspection and what is the zip code number of it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T2.results, T1.zip FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.license_no = 1222441",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.results, T1.zip FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.license_no = 1222441",
"index": 3055,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['LICENSE', 'license', 'License', 'Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlicense number 1222441 refers to license_no = 1222441; result of the inspection refers to results; zip code number refers to zip\nDid license number 1222441 pass the inspection and what is the zip code number of it?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness name refers to dba_name; food business refers to restaurant; pass the inspection refers to results = 'Pass'; in 2010 refers to inspection_date like '2010%'\nName the food businesses that passed the inspection in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T2.inspection_date) = '2010' AND T2.results = 'Pass' AND T1.facility_type = 'Liquor'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T2.inspection_date) = '2010' AND T2.results = 'Pass' AND T1.facility_type = 'Liquor'",
"index": 3056,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n city text, -- example: ['Chicago', 'Park Forest']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n zip integer, -- example: [60644, 60606]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nbusiness name refers to dba_name; food business refers to restaurant; pass the inspection refers to results = 'Pass'; in 2010 refers to inspection_date like '2010%'\nName the food businesses that passed the inspection in 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Joshua', 'Anastasia']\n last_name text, -- example: ['Rosa', 'Hansen']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\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 the establishment refers to dba_name\nWhat is the name of the establishment that Joshua Rosa inspected?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T3.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'",
"index": 3057,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Joshua', 'Anastasia']\n last_name text, -- example: ['Rosa', 'Hansen']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\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 the establishment refers to dba_name\nWhat is the name of the establishment that Joshua Rosa inspected?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlicense number 1576687 refers to license_no = 1576687\nWhat is the title of the employee that inspected the establishment with license number 1576687?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.license_no = 1576687",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.license_no = 1576687",
"index": 3058,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlicense number 1576687 refers to license_no = 1576687\nWhat is the title of the employee that inspected the establishment with license number 1576687?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na risk level of 1 refers to risk_level = 1; pass the inspection refers to results = 'Pass'; percentage = divide(sum(license_no where risk_level = 1), count(license_no)) * 100% where results = 'Pass'\nWhat is the percentage of establishments with a risk level of 1 among all of the establishments that passed the inspection?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST(COUNT(CASE WHEN T1.risk_level = 1 THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.results = 'Pass'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.risk_level = 1 THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.results = 'Pass'",
"index": 3059,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n risk_level integer, -- example: [2, 1]\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na risk level of 1 refers to risk_level = 1; pass the inspection refers to results = 'Pass'; percentage = divide(sum(license_no where risk_level = 1), count(license_no)) * 100% where results = 'Pass'\nWhat is the percentage of establishments with a risk level of 1 among all of the establishments that passed the inspection?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Kinetic Playground', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe establishment named \"Kinetic Playground\" refers to dba_name = 'Kinetic Playground'\nWhat is the facility type of the establishment named \"Kinetic Playground\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground'",
"index": 3060,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Kinetic Playground', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe establishment named \"Kinetic Playground\" refers to dba_name = 'Kinetic Playground'\nWhat is the facility type of the establishment named \"Kinetic Playground\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anthony', 'Jessica', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Anthony', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow much salary does Jessica Anthony receive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT salary FROM employee WHERE first_name = 'Jessica' AND last_name = 'Anthony'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT salary FROM employee WHERE first_name = 'Jessica' AND last_name = 'Anthony'",
"index": 3061,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anthony', 'Jessica', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Anthony', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHow much salary does Jessica Anthony receive?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to facility_type = 'Restaurant'; name refers to dba_name; \"41.9532864854\" latitude and \"-87.7673790701422\" longitude refers to latitude = 41.9532864854 and longitude = -87.7673790701422\nWhat is the restaurant's name at \"41.9532864854\" latitude and \"-87.7673790701422\" longitude?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT dba_name FROM establishment WHERE latitude = 41.9532864854 AND longitude = -87.7673790701422 AND facility_type = 'Restaurant'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT dba_name FROM establishment WHERE latitude = 41.9532864854 AND longitude = -87.7673790701422 AND facility_type = 'Restaurant'",
"index": 3062,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nrestaurant refers to facility_type = 'Restaurant'; name refers to dba_name; \"41.9532864854\" latitude and \"-87.7673790701422\" longitude refers to latitude = 41.9532864854 and longitude = -87.7673790701422\nWhat is the restaurant's name at \"41.9532864854\" latitude and \"-87.7673790701422\" longitude?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['OLD TIMERS REST & LOUNGE', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 Chicago refers to city = 'CHICAGO'; restaurant refers to facility_type = 'Restaurant'; \"Old Timers Rest & Lounge\" refers to dba_name = 'OLD TIMERS REST & LOUNGE'; location refers to address\nWhere in Chicago does the restaurant named \"Old Timers Rest & Lounge\" 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 address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant'",
"index": 3063,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_type text, -- example: ['Complaint', 'Canvass']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['OLD TIMERS REST & LOUNGE', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['restaurant', 'Restaurant', 'Special Event']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHicago', 'chicago', 'Chicago', 'CHICAGO']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 Chicago refers to city = 'CHICAGO'; restaurant refers to facility_type = 'Restaurant'; \"Old Timers Rest & Lounge\" refers to dba_name = 'OLD TIMERS REST & LOUNGE'; location refers to address\nWhere in Chicago does the restaurant named \"Old Timers Rest & Lounge\" 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 violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n risk_level integer, -- example: [2, 1]\n state text, -- example: ['IL']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_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 number of establishments with the highest risk level = count(max(risk_level))\nWhat is the total number of establishments with the highest risk level?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(license_no) FROM establishment WHERE risk_level = 3",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(license_no) FROM establishment WHERE risk_level = 3",
"index": 3064,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n risk_level integer, -- example: [2, 1]\n state text, -- example: ['IL']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n PRIMARY KEY (point_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 number of establishments with the highest risk level = count(max(risk_level))\nWhat is the total number of establishments with the highest risk level?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee name refers to first_name, last_name; receives 82700 as salary refers to salary = 82700\nWho is the employee that receives 82700 as their salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 employee WHERE salary = 82700",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT first_name, last_name FROM employee WHERE salary = 82700",
"index": 3065,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nemployee name refers to first_name, last_name; receives 82700 as salary refers to salary = 82700\nWho is the employee that receives 82700 as their salary?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['tavern', 'Tavern', 'TAVERN', 'Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to dba_name; tavern refers to facility_type = 'Tavern'; a $100 fine refers to fine = 100\nPlease list the names of taverns that paid a $100 fine upon inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Tavern' AND T3.fine = 100",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Tavern' AND T3.fine = 100",
"index": 3066,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['tavern', 'Tavern', 'TAVERN', 'Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n city text, -- example: ['Chicago', 'Park Forest']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nname refers to dba_name; tavern refers to facility_type = 'Tavern'; a $100 fine refers to fine = 100\nPlease list the names of taverns that paid a $100 fine upon inspection.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno fine refers to fine = 0\nList point level of inspections with no fine.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.point_level FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.fine = 0",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.point_level FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.fine = 0",
"index": 3067,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['Level', 'HARVEST CRUSADES MINISTRIES', 'COSI']\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nno fine refers to fine = 0\nList point level of inspections with no fine.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Arnold', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Holder', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-02-24', '2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFebruary 24, 2010 refers to inspection_date = '2010-02-24'\nWhat is the result of the February 24, 2010 inspection involving the employee named \"Arnold Holder\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-02-24' AND T1.first_name = 'Arnold' AND T1.last_name = 'Holder'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-02-24' AND T1.first_name = 'Arnold' AND T1.last_name = 'Holder'",
"index": 3068,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Arnold', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Holder', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-02-24', '2010-01-05', '2010-01-21']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFebruary 24, 2010 refers to inspection_date = '2010-02-24'\nWhat is the result of the February 24, 2010 inspection involving the employee named \"Arnold Holder\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Rosemary', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Kennedy', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 inspection IDs where the employee named \"Rosemary Kennedy\" was involved.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Rosemary' AND T1.last_name = 'Kennedy'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T2.inspection_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Rosemary' AND T1.last_name = 'Kennedy'",
"index": 3069,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Rosemary', 'Anastasia', 'Joshua']\n last_name text, -- example: ['Kennedy', 'Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_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 inspection IDs where the employee named \"Rosemary Kennedy\" was involved.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['PROVIDED', 'All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-030, 015, 010 (A), 005 (A)', '7-38-030', '7-38-031', '7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomment \"MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA\" refers to inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA'; sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A) refers to code = '7-38-030, 015, 010 (A), 005 (A)'\nProvide the inspection ID of the inspection with the comment \"MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA\" and sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA' AND T1.code = '7-38-030, 015, 010 (A), 005 (A)'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA' AND T1.code = '7-38-030, 015, 010 (A), 005 (A)'",
"index": 3070,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['PROVIDED', 'All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n address text, -- example: ['6023 S Elizabeth St', '5000 N Wolcott Ave']\n state text, -- example: ['IL']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n city text, -- example: ['CHICAGO', 'Chicago']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n code text, -- example: ['7-38-030, 015, 010 (A), 005 (A)', '7-38-030', '7-38-031', '7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomment \"MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA\" refers to inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA'; sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A) refers to code = '7-38-030, 015, 010 (A), 005 (A)'\nProvide the inspection ID of the inspection with the comment \"MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA\" and sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A).\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Grocery Store', 'GROCERY', 'grocery', 'STORE', 'Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngrocery store refers to facility_type = 'Grocery Store'; $250 fine refers to fine = 250\nHow many grocery stores paid $250 fine upon their inspection?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Grocery Store' AND T3.fine = 250",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Grocery Store' AND T3.fine = 250",
"index": 3071,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Critical', 'Serious ']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n facility_type text, -- example: ['Grocery Store', 'GROCERY', 'grocery', 'STORE', 'Special Event', 'Restaurant']\n zip integer, -- example: [60644, 60606]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n zip integer, -- example: [60636, 60640]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngrocery store refers to facility_type = 'Grocery Store'; $250 fine refers to fine = 250\nHow many grocery stores paid $250 fine upon their inspection?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['tavern', 'Tavern', 'TAVERN', 'Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntavern refers to facility_type = 'Tavern'; failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'\nName the taverns that failed the inspection in January 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE strftime('%Y-%m', T2.inspection_date) = '2010-01' AND T2.results = 'Fail' AND T1.facility_type = 'TAVERN'",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE strftime('%Y-%m', T2.inspection_date) = '2010-01' AND T2.results = 'Fail' AND T1.facility_type = 'TAVERN'",
"index": 3072,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n code text, -- example: ['7-38-005 (B) (B-2)', '7-38-005 (A)']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['tavern', 'Tavern', 'TAVERN', 'Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntavern refers to facility_type = 'Tavern'; failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'\nName the taverns that failed the inspection in January 2010.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Serious ', 'Critical']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nserious point level refers to point_level = 'Serious'; no fines refers to fine = 0\nHow many of the inspections with serious point levels have no fines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0",
"index": 3073,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n fine integer, -- example: [500, 250]\n point_level text, -- example: ['Serious ', 'Critical']\n PRIMARY KEY (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n state text, -- example: ['IL']\n latitude real, -- example: [41.8828450747188, 41.8807571586472]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n results text, -- example: ['Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nserious point level refers to point_level = 'Serious'; no fines refers to fine = 0\nHow many of the inspections with serious point levels have no fines?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfailed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'; name of employee refers to first_name, last_name; a salary greater than 70% of the average salary refers to salary > multiply(avg(salary), 0.7)\nAmong the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.employee_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee )",
"style": "rule"
} | {
"db_id": "food_inspection_2.sqlite",
"gt_sql": "SELECT DISTINCT T1.employee_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee )",
"index": 3074,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE violation (\n inspection_id integer, -- example: [44247, 44248]\n point_id integer, -- example: [30, 32]\n fine integer, -- example: [100, 0]\n inspector_comment text, -- example: ['All food not stored in the original cont', \"OBSERVED TORN DOOR GASKET ON DOOR OF 'CH\"]\n PRIMARY KEY (inspection_id, point_id),\n CONSTRAINT fk_violation_inspection_id FOREIGN KEY (inspection_id) REFERENCES inspection (inspection_id),\n CONSTRAINT fk_violation_point_id FOREIGN KEY (point_id) REFERENCES inspection_point (point_id)\n);\n\nCREATE TABLE establishment (\n license_no integer, -- license number, example: [1, 2]\n dba_name text, -- doing business as name, example: ['HARVEST CRUSADES MINISTRIES', 'COSI']\n aka_name text, -- as know as name, example: ['COSI', \"KING'S CHINESE/PARK MANOR LOUNGE\"]\n facility_type text, -- example: ['Special Event', 'Restaurant']\n risk_level integer, -- example: [2, 1]\n address text, -- example: ['118 N CENTRAL AVE ', '230 W MONROE ST ']\n city text, -- example: ['CHICAGO', 'Chicago']\n state text, -- example: ['IL']\n zip integer, -- example: [60644, 60606]\n longitude real, -- example: [-87.7650954520439, -87.6347092983425]\n ward integer, -- example: [29, 42]\n PRIMARY KEY (license_no)\n);\n\nCREATE TABLE inspection (\n inspection_id integer, -- example: [44247, 44248]\n inspection_date date, -- example: ['2010-01-05', '2010-01-21']\n inspection_type text, -- example: ['Complaint', 'Canvass']\n results text, -- example: ['Fail', 'Pass', 'Pass w/ Conditions']\n employee_id integer, -- example: [141319, 143902]\n license_no integer, -- license number, example: [1222441, 1336561]\n followup_to integer, -- example: [67871, 248210]\n PRIMARY KEY (inspection_id),\n CONSTRAINT fk_inspection_employee_id FOREIGN KEY (employee_id) REFERENCES employee (employee_id),\n CONSTRAINT fk_inspection_license_no FOREIGN KEY (license_no) REFERENCES establishment (license_no),\n CONSTRAINT fk_inspection_followup_to FOREIGN KEY (followup_to) REFERENCES inspection (inspection_id)\n);\n\nCREATE TABLE employee (\n employee_id integer, -- example: [103705, 104633]\n first_name text, -- example: ['Anastasia', 'Joshua']\n last_name text, -- example: ['Hansen', 'Rosa']\n city text, -- example: ['Chicago', 'Park Forest']\n zip integer, -- example: [60636, 60640]\n phone text, -- example: ['(773) 424-8729', '(773) 293-6409']\n title text, -- example: ['Sanitarian', 'Supervisor']\n salary integer, -- example: [79300, 82000]\n supervisor integer, -- example: [177316, 186742]\n PRIMARY KEY (employee_id),\n CONSTRAINT fk_employee_supervisor FOREIGN KEY (supervisor) REFERENCES employee (employee_id)\n);\n\nCREATE TABLE inspection_point (\n point_id integer, -- example: [1, 2]\n Description text, -- example: ['Source sound condition, no spoilage, foo', 'Facilities to maintain proper temperatur']\n category text, -- example: ['Food Protection', 'Food Equipment and Utensil Sanitation']\n fine integer, -- example: [500, 250]\n PRIMARY KEY (point_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfailed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'; name of employee refers to first_name, last_name; a salary greater than 70% of the average salary refers to salary > multiply(avg(salary), 0.7)\nAmong the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2016-11-10', '2016-11-16', '2016-11-11', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Argentum', 'COIN', 'Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (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 value in the past 24 hours refers to volume_24h; on 11/10/16 refers to date = '2016-11-10'\nWhat is the total value of Argentum coined traded in the past 24 hours on 2016/10/11.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.volume_24h FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Argentum' AND T2.date = '2016-10-11'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.volume_24h FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Argentum' AND T2.date = '2016-10-11'",
"index": 3075,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2016-11-10', '2016-11-16', '2016-11-11', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Argentum', 'COIN', 'Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (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 value in the past 24 hours refers to volume_24h; on 11/10/16 refers to date = '2016-11-10'\nWhat is the total value of Argentum coined traded in the past 24 hours on 2016/10/11.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['DigixDAO', 'Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n time_low text, -- example: ['05:20:01', '19:25:02']\n percent_change_7d real, -- example: [-13.809, -16.7201]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest price refers to max(price); DigixDAO refers to name = 'DigixDAO'\nState the transaction date whereby DigixDAO was transacted at the hightest 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.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'DigixDAO' ORDER BY T2.price DESC LIMIT 1",
"index": 3076,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['DigixDAO', 'Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n time_low text, -- example: ['05:20:01', '19:25:02']\n percent_change_7d real, -- example: [-13.809, -16.7201]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest price refers to max(price); DigixDAO refers to name = 'DigixDAO'\nState the transaction date whereby DigixDAO was transacted at the hightest 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 historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Change', 'COIN', 'Bitcoin', 'Litecoin']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest percentage price changed in 24 hours refers to max(percent_change_24h)\nName the coin with the highest percentage price changed in 24 hours. State the transaction date and 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 T1.name, T2.DATE, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.percent_change_24h = ( SELECT MAX(percent_change_24h) FROM historical )",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name, T2.DATE, T2.price FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.percent_change_24h = ( SELECT MAX(percent_change_24h) FROM historical )",
"index": 3077,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Change', 'COIN', 'Bitcoin', 'Litecoin']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest percentage price changed in 24 hours refers to max(percent_change_24h)\nName the coin with the highest percentage price changed in 24 hours. State the transaction date and 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 coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['status', 'coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['COIN', 'ITS', 'ALL', 'MAX', 'BTC', 'LTC']\n status text, -- example: ['inactive', 'active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe last date refers to max(date); inactive coins refers to status = 'inactive'\nList all the inactive coins and state the last date of its transaction?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.NAME, MAX(T2.DATE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T1.status = 'inactive' ORDER BY T2.DATE DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.NAME, MAX(T2.DATE) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.ID = T2.coin_id WHERE T1.status = 'inactive' ORDER BY T2.DATE DESC LIMIT 1",
"index": 3078,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['status', 'coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['COIN', 'ITS', 'ALL', 'MAX', 'BTC', 'LTC']\n status text, -- example: ['inactive', 'active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe last date refers to max(date); inactive coins refers to status = 'inactive'\nList all the inactive coins and state the last date of its transaction?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage price more than $1000 refers to AVG(price)>1000\nFor all coins with average price more than $1000. State the current status of the coin.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.status FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id GROUP BY T1.name HAVING AVG(T2.price) > 1000",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.status FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id GROUP BY T1.name HAVING AVG(T2.price) > 1000",
"index": 3079,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage price more than $1000 refers to AVG(price)>1000\nFor all coins with average price more than $1000. State the current status of the coin.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'Bitcoin', 'Litecoin']\n category text, -- example: ['token', 'coin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest max profit refers to max(subtract(high, low))\nName the coin under the token category that gives the highest max profit.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.category = 'token' ORDER BY T2.high - T2.low DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.category = 'token' ORDER BY T2.high - T2.low DESC LIMIT 1",
"index": 3080,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'Bitcoin', 'Litecoin']\n category text, -- example: ['token', 'coin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest max profit refers to max(subtract(high, low))\nName the coin under the token category that gives the highest max profit.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Change', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['change', 'coin', 'bitcoin', 'litecoin']\n status text, -- example: ['active', 'untracked']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage percentage price changed from the previous 24 hours refers to AVG(percent_change_24h); on 15/5/2013 refers to DATE = '2013-04-15'\nName the coin that have higher than average percentage price changed from the previous 24 hours for transaction on 2013/6/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 T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2020-06-22' GROUP BY T1.name HAVING AVG(T2.percent_change_24h) > T2.PRICE",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2020-06-22' GROUP BY T1.name HAVING AVG(T2.percent_change_24h) > T2.PRICE",
"index": 3081,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Change', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['change', 'coin', 'bitcoin', 'litecoin']\n status text, -- example: ['active', 'untracked']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage percentage price changed from the previous 24 hours refers to AVG(percent_change_24h); on 15/5/2013 refers to DATE = '2013-04-15'\nName the coin that have higher than average percentage price changed from the previous 24 hours for transaction on 2013/6/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 coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n time_low text, -- example: ['05:20:01', '19:25:02']\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nranked the first refers to cmc_rank = 1; on 2013/4/28 refers to date = '2013-04-28'\nWhich crytocurrency was ranked the first by CoinMarketCap on 2013/4/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T2.cmc_rank = 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T2.cmc_rank = 1",
"index": 3082,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n time_low text, -- example: ['05:20:01', '19:25:02']\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nranked the first refers to cmc_rank = 1; on 2013/4/28 refers to date = '2013-04-28'\nWhich crytocurrency was ranked the first by CoinMarketCap on 2013/4/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Dollars', 'COIN', 'Litecoin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n time_high text, -- example: ['13:15:01', '13:15:03']\n percent_change_24h real, -- example: [7.63553, 0.920718]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworth refers to price; on 2013/4/28 refers to date = '2013-04-28'\nHow much dollars was a Bitcoin worth on 2013/4/28 according to the coin market?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.market_cap FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.market_cap FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'",
"index": 3083,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Dollars', 'COIN', 'Litecoin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n time_high text, -- example: ['13:15:01', '13:15:03']\n percent_change_24h real, -- example: [7.63553, 0.920718]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nworth refers to price; on 2013/4/28 refers to date = '2013-04-28'\nHow much dollars was a Bitcoin worth on 2013/4/28 according to the coin market?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-05-03', '2013-05-05', '2013-05-08', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot opened refers to open IS NULL; on 2013/5/3 refers to date = '2013-05-03'\nWhich crytocurrency was not opened on 2013/5/3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-03' AND T2.open IS NULL",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-03' AND T2.open IS NULL",
"index": 3084,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-05-03', '2013-05-05', '2013-05-08', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnot opened refers to open IS NULL; on 2013/5/3 refers to date = '2013-05-03'\nWhich crytocurrency was not opened on 2013/5/3?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-29', '2013-04-28']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'COIN', 'Litecoin']\n slug text, -- example: ['bitcoin', 'coin', 'litecoin']\n symbol text, -- example: ['WHEN', 'COIN', 'TIME', 'ITS', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntime that a coin reaches its highest price refers to time_high; on 2013/4/29 refers to date = '2013-04-29'\nWhen did Bitcoin reach its highest price on 2013/4/29?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.time_high FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T1.name = 'Bitcoin'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.time_high FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-29' AND T1.name = 'Bitcoin'",
"index": 3085,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-29', '2013-04-28']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'COIN', 'Litecoin']\n slug text, -- example: ['bitcoin', 'coin', 'litecoin']\n symbol text, -- example: ['WHEN', 'COIN', 'TIME', 'ITS', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntime that a coin reaches its highest price refers to time_high; on 2013/4/29 refers to date = '2013-04-29'\nWhen did Bitcoin reach its highest price on 2013/4/29?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe max profit = subtract(high, low); on 2013/4/28 refers to date = '2013-04-28'\nWhat was the max profit a user can make on Bitcoin on 2013/4/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.high - T2.low FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.high - T2.low FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-04-28' AND T1.name = 'Bitcoin'",
"index": 3086,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe max profit = subtract(high, low); on 2013/4/28 refers to date = '2013-04-28'\nWhat was the max profit a user can make on Bitcoin on 2013/4/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2016-01-08', '2016-01-01', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntraded in the highest value refers to max(volume_24h); on 2016/1/8 refers to date = '2016-01-08'\nWhich crytocurrency was traded in the highest value on 2016/1/8?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2016-01-08' AND T2.volume_24h = ( SELECT MAX(volume_24h) FROM historical WHERE date = '2016-01-08' )",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2016-01-08' AND T2.volume_24h = ( SELECT MAX(volume_24h) FROM historical WHERE date = '2016-01-08' )",
"index": 3087,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2016-01-08', '2016-01-01', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n status text, -- example: ['active', 'untracked']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntraded in the highest value refers to max(volume_24h); on 2016/1/8 refers to date = '2016-01-08'\nWhich crytocurrency was traded in the highest value on 2016/1/8?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-05-05', '2013-05-09', '2013-05-08', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n slug text, -- example: ['bitcoin', 'litecoin']\n symbol text, -- example: ['DAY', 'S', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (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 increased refers to percent_change_7d>0; decreased refers percent_change_7d<0; on 2013/5/5 refers to date = '2013-05-05'\nHad Bitcoin's price increased or decreased on 2013/5/5 compared with the price 7 days before?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT (CASE WHEN T2.percent_change_7d > 0 THEN 'INCREASED' ELSE 'DECREASED' END) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-05' AND T1.name = 'Bitcoin'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT (CASE WHEN T2.percent_change_7d > 0 THEN 'INCREASED' ELSE 'DECREASED' END) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2013-05-05' AND T1.name = 'Bitcoin'",
"index": 3088,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-05-05', '2013-05-09', '2013-05-08', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n slug text, -- example: ['bitcoin', 'litecoin']\n symbol text, -- example: ['DAY', 'S', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (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 increased refers to percent_change_7d>0; decreased refers percent_change_7d<0; on 2013/5/5 refers to date = '2013-05-05'\nHad Bitcoin's price increased or decreased on 2013/5/5 compared with the price 7 days before?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n slug text, -- example: ['bitcoin', 'litecoin']\n symbol text, -- example: ['BURN', 'SUM', 'BTC', 'LTC']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n volume_24h real, -- example: [0.0, 46862728.0]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe percentage of the Bitcoins verifiably burned = divide(subtract(SUM(max_supply), SUM(total_supply)),SUM(total_supply))*100%; until 2013/4/28 refers to date<'2013-04-08'\nWhat was the percentage of the Bitcoins verifiably burned until 2018/4/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST((SUM(T2.max_supply) - SUM(T2.total_supply)) AS REAL) / SUM(T2.total_supply) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date < '2018-04-28' AND T1.name = 'Bitcoin'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT CAST((SUM(T2.max_supply) - SUM(T2.total_supply)) AS REAL) / SUM(T2.total_supply) FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date < '2018-04-28' AND T1.name = 'Bitcoin'",
"index": 3089,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n slug text, -- example: ['bitcoin', 'litecoin']\n symbol text, -- example: ['BURN', 'SUM', 'BTC', 'LTC']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n volume_24h real, -- example: [0.0, 46862728.0]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe percentage of the Bitcoins verifiably burned = divide(subtract(SUM(max_supply), SUM(total_supply)),SUM(total_supply))*100%; until 2013/4/28 refers to date<'2013-04-08'\nWhat was the percentage of the Bitcoins verifiably burned until 2018/4/28?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['status', 'coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['COIN', 'NAME', 'BTC', 'LTC']\n status text, -- example: ['extinct', 'active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas disappeared refers to status = 'extinct'\nPlease list the names of coins that has been disappeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM coins WHERE status = 'extinct'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT name FROM coins WHERE status = 'extinct'",
"index": 3090,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['status', 'coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['COIN', 'NAME', 'BTC', 'LTC']\n status text, -- example: ['extinct', 'active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhas disappeared refers to status = 'extinct'\nPlease list the names of coins that has been disappeared.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n time_high text, -- example: ['13:15:01', '13:15:03']\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'MANY', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['coin', 'many', 'bitcoin', 'litecoin']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (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 May 2013 refers to year(date_added) = 2013 and month(date_added) = 5\nHow many coins were added in May 2013? Please list the names of coins.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(id) num FROM coins WHERE STRFTIME('%Y-%m', date_added) = '2013-05' UNION ALL SELECT name FROM coins WHERE STRFTIME('%Y-%m', date_added) = '2013-05'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT COUNT(id) num FROM coins WHERE STRFTIME('%Y-%m', date_added) = '2013-05' UNION ALL SELECT name FROM coins WHERE STRFTIME('%Y-%m', date_added) = '2013-05'",
"index": 3091,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n time_high text, -- example: ['13:15:01', '13:15:03']\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'MANY', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['coin', 'many', 'bitcoin', 'litecoin']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (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 May 2013 refers to year(date_added) = 2013 and month(date_added) = 5\nHow many coins were added in May 2013? Please list the names of coins.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-06-14', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Symbol', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['symbol', 'coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['COIN', 'NAME', 'LIKE', 'AD', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nadded on June 14, 2013 refers to date_added like '2013-06-14%'\nList the names and symbols of the coins that were added on June 14, 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT name, symbol FROM coins WHERE date_added LIKE '2013-06-14%'",
"index": 3092,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-06-14', '2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Symbol', 'COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['symbol', 'coin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['COIN', 'NAME', 'LIKE', 'AD', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nadded on June 14, 2013 refers to date_added like '2013-06-14%'\nList the names and symbols of the coins that were added on June 14, 2013.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n symbol text, -- example: ['TRADE', 'COIN', 'NAME', 'YEAR', 'CAN', 'BTC']\n status text, -- example: ['untracked', 'active']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n total_supply real, -- example: [11091325.0, 17164230.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncannot be tracked refers to status = 'untracked'; in 2014 refers to year(date_added) = '2014'\nList the names of coins that cannot be traded in 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT name FROM coins WHERE date_added LIKE '2014%' AND status = 'untracked'",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT name FROM coins WHERE date_added LIKE '2014%' AND status = 'untracked'",
"index": 3093,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Status', 'COIN', 'Bitcoin', 'Litecoin']\n symbol text, -- example: ['TRADE', 'COIN', 'NAME', 'YEAR', 'CAN', 'BTC']\n status text, -- example: ['untracked', 'active']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n total_supply real, -- example: [11091325.0, 17164230.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncannot be tracked refers to status = 'untracked'; in 2014 refers to year(date_added) = '2014'\nList the names of coins that cannot be traded in 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['coin', 'bitcoin', 'litecoin']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest price refers to max(price)\nWhat is the name of the coin with the highest 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 T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.price = ( SELECT MAX(price) FROM historical )",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.price = ( SELECT MAX(price) FROM historical )",
"index": 3094,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['coin', 'bitcoin', 'litecoin']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n notice text, -- example: ['TIPS has undergone a [swap](https://bitc', 'We have received reports that withdrawal']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n website text, -- example: ['https://bitcoin.org/', 'https://litecoin.org/']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_high text, -- example: ['13:15:01', '13:15:03']\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest price refers to max(price)\nWhat is the name of the coin with the highest 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 coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n slug text, -- example: ['bitcoin', 'litecoin']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n platform_id integer, -- example: [1027, 1765]\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest price refers to low; best time refers to date with the low;\nWhen is the best time to purchase Bitcoin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.low LIMIT 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Bitcoin' ORDER BY T2.low LIMIT 1",
"index": 3095,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Bitcoin', 'Litecoin']\n slug text, -- example: ['bitcoin', 'litecoin']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['Bitcoin', 'bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n platform_id integer, -- example: [1027, 1765]\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nlowest price refers to low; best time refers to date with the low;\nWhen is the best time to purchase Bitcoin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['CHNCoin', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['chncoin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['WHEN', 'MAX', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest closed price refers to max(close)\nWhen is the highest closed price of CHNCoin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'CHNCoin' ORDER BY T2.close DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'CHNCoin' ORDER BY T2.close DESC LIMIT 1",
"index": 3096,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['CHNCoin', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['chncoin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['WHEN', 'MAX', 'BTC', 'LTC']\n status text, -- example: ['active', 'untracked']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n price real, -- example: [134.210021972656, 4.34840488433838]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_1h real, -- example: [0.639231, 0.799273]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe highest closed price refers to max(close)\nWhen is the highest closed price of CHNCoin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Devcoin', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['devcoin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['MOST', 'WHEN', 'MAX', 'BTC', 'LTC']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen refers to date; most valuable refers to max(market_cap)\nWhen is Devcoin most valuable in the market?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Devcoin' ORDER BY T2.market_cap DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Devcoin' ORDER BY T2.market_cap DESC LIMIT 1",
"index": 3097,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Devcoin', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['devcoin', 'bitcoin', 'litecoin']\n symbol text, -- example: ['MOST', 'WHEN', 'MAX', 'BTC', 'LTC']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\n\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n high real, -- example: [147.48800659179688, 4.573599815368652]\n low real, -- example: [134.0, 4.225639820098877]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen refers to date; most valuable refers to max(market_cap)\nWhen is Devcoin most valuable in the market?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2014-01-01', '2014-01-09', '2014-01-08', '2014-01-07', '2014-01-06', '2014-01-05']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_low text, -- example: ['05:20:01', '19:25:02']\n percent_change_7d real, -- example: [-13.809, -16.7201]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'TOP', 'Bitcoin', 'Litecoin']\n symbol text, -- example: ['TRADE', 'NAME', 'COIN', 'TOP', 'BTC', 'LTC']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe top five coins refers to cmc_rank< = 5; on January 1, 2014 refers to date = '2014-01-01'\nList the names of the top five coins traded on January 1, 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2014-01-01' AND T2.cmc_rank <= 5",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT T1.name FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T2.date = '2014-01-01' AND T2.cmc_rank <= 5",
"index": 3098,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2014-01-01', '2014-01-09', '2014-01-08', '2014-01-07', '2014-01-06', '2014-01-05']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n market_cap real, -- Market capitalization, example: [1488566971.9558687, 74637021.56790735]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n close real, -- example: [144.5399932861328, 4.383900165557861]\n time_low text, -- example: ['05:20:01', '19:25:02']\n percent_change_7d real, -- example: [-13.809, -16.7201]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['COIN', 'TOP', 'Bitcoin', 'Litecoin']\n symbol text, -- example: ['TRADE', 'NAME', 'COIN', 'TOP', 'BTC', 'LTC']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n platform_id integer, -- example: [1027, 1765]\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe top five coins refers to cmc_rank< = 5; on January 1, 2014 refers to date = '2014-01-01'\nList the names of the top five coins traded on January 1, 2014.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Lebowskis', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['lebowskis', 'bitcoin', 'litecoin']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen refers to date; not opened refers to open IS NULL\nWhen was Lebowskis not opened?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Lebowskis' AND (T2.open IS NULL OR T2.open = 0)",
"style": "rule"
} | {
"db_id": "coinmarketcap.sqlite",
"gt_sql": "SELECT DISTINCT T2.date FROM coins AS T1 INNER JOIN historical AS T2 ON T1.id = T2.coin_id WHERE T1.name = 'Lebowskis' AND (T2.open IS NULL OR T2.open = 0)",
"index": 3099,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE historical (\n `date` date, -- example: ['2013-04-28', '2013-04-29']\n coin_id integer, -- example: [1, 2]\n cmc_rank integer, -- coinmarketcap rank, example: [1, 2]\n `open` real, -- example: [134.44400024414062, 4.366759777069092]\n low real, -- example: [134.0, 4.225639820098877]\n time_low text, -- example: ['05:20:01', '19:25:02']\n volume_24h real, -- example: [0.0, 46862728.0]\n percent_change_24h real, -- example: [7.63553, 0.920718]\n percent_change_7d real, -- example: [-13.809, -16.7201]\n circulating_supply real, -- example: [11091325.0, 17164230.0]\n total_supply real, -- example: [11091325.0, 17164230.0]\n max_supply real, -- example: [21000000.0, 84000000.0]\n num_market_pairs integer, -- number market pairs, example: [7050, 5146]\n);\n\nCREATE TABLE coins (\n id integer, -- example: [1, 2]\n name text, -- example: ['Lebowskis', 'Bitcoin', 'Litecoin']\n slug text, -- example: ['lebowskis', 'bitcoin', 'litecoin']\n status text, -- example: ['active', 'untracked']\n category text, -- example: ['coin', 'token']\n description text, -- example: ['## **What Is Bitcoin (BTC)?**\\\\n\\\\nBitcoin', '## What Is Litecoin (LTC)?\\\\n\\\\nLitecoin (']\n subreddit text, -- example: ['bitcoin', 'litecoin']\n tags text, -- example: ['mineable, pow, sha-256, store-of-value, ', 'mineable, pow, scrypt, medium-of-exchang']\n tag_names text, -- example: ['Mineable, PoW, SHA-256, Store of Value, ', 'Mineable, PoW, Scrypt, Medium of Exchang']\n platform_id integer, -- example: [1027, 1765]\n date_added text, -- example: ['2013-04-28T00:00:00.000Z', '2013-05-03T00:00:00.000Z']\n date_launched text, -- date lanched, example: ['2018-01-16T00:00:00.000Z', '2018-05-01T00:00:00.000Z']\n PRIMARY KEY (id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwhen refers to date; not opened refers to open IS NULL\nWhen was Lebowskis not opened?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.