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 lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nline item number refers to l_linenumber; 10% off refers to l_discount = 0.1\nPlease list any three line item numbers that have 10% off.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT l_linenumber FROM lineitem WHERE l_discount = 0.1 LIMIT 3",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT l_linenumber FROM lineitem WHERE l_discount = 0.1 LIMIT 3",
"index": 3200,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nline item number refers to l_linenumber; 10% off refers to l_discount = 0.1\nPlease list any three line item numbers that have 10% off.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_shipmode text, -- line item ship mode, example: ['MAIL', 'RAIL', 'SHIP', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['DELIVER IN PERSON', 'NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nship mode refers to l_shipmode; \"deliver in person\" instruction refers to l_shipinstruct = 'DELIVER IN PERSON'\nWhich ship mode has more \"deliver in person\" instructions, rail or mail?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT IIF(SUM(IIF(l_shipmode = 'RAIL', 1, 0)) - SUM(IIF(l_shipmode = 'MAIL', 1, 0)), 'RAIL', 'MAIL') AS result FROM lineitem WHERE l_shipinstruct = 'DELIVER IN PERSON'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT IIF(SUM(IIF(l_shipmode = 'RAIL', 1, 0)) - SUM(IIF(l_shipmode = 'MAIL', 1, 0)), 'RAIL', 'MAIL') AS result FROM lineitem WHERE l_shipinstruct = 'DELIVER IN PERSON'",
"index": 3201,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_shipmode text, -- line item ship mode, example: ['MAIL', 'RAIL', 'SHIP', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['DELIVER IN PERSON', 'NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nship mode refers to l_shipmode; \"deliver in person\" instruction refers to l_shipinstruct = 'DELIVER IN PERSON'\nWhich ship mode has more \"deliver in person\" instructions, rail or mail?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'R', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull price of under 16947.7 refers to l_extendedprice < 16947.7; returned item refers to l_returnflag = 'R'; not returned item refers to l_returnflag = 'A' OR l_returnflag = 'N'; difference = subtract(count(l_linenumber where l_returnflag = 'A' OR l_returnflag = 'N'), count(l_linenumber where l_returnflag = 'R')) where l_extendedprice < 16947.7\nWhat is the difference between the number of returned items and not returned items with the full price of under 16947.7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(IIF(l_returnflag = 'A', 1, 0)) - SUM(IIF(l_returnflag = 'N', 1, 0)) AS diff FROM lineitem WHERE l_extendedprice < 16947.7",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT SUM(IIF(l_returnflag = 'A', 1, 0)) - SUM(IIF(l_returnflag = 'N', 1, 0)) AS diff FROM lineitem WHERE l_extendedprice < 16947.7",
"index": 3202,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'R', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfull price of under 16947.7 refers to l_extendedprice < 16947.7; returned item refers to l_returnflag = 'R'; not returned item refers to l_returnflag = 'A' OR l_returnflag = 'N'; difference = subtract(count(l_linenumber where l_returnflag = 'A' OR l_returnflag = 'N'), count(l_linenumber where l_returnflag = 'R')) where l_extendedprice < 16947.7\nWhat is the difference between the number of returned items and not returned items with the full price of under 16947.7?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupply cost refers to ps_supplycost; large plated tin refers to p_type = 'large plated tin'\nWhat is the supply cost of large plated tin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_type = 'large plated tin'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_type = 'large plated tin'",
"index": 3203,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupply cost refers to ps_supplycost; large plated tin refers to p_type = 'large plated tin'\nWhat is the supply cost of large plated tin?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry is nation name which refers to n_name; Africa is region name refers to r_name = 'Africa'\nWhat are the countries that belong to Africa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T1.r_name = 'Africa'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.n_name FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T1.r_name = 'Africa'",
"index": 3204,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry is nation name which refers to n_name; Africa is region name refers to r_name = 'Africa'\nWhat are the countries that belong to Africa?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to has r_name; the lowest number of countries refers to min(count(n_name))\nWhich region has the lowest number of countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.r_name FROM ( SELECT T1.r_name, COUNT(T2.n_name) AS num FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey GROUP BY T1.r_name ) AS T ORDER BY T.num LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T.r_name FROM ( SELECT T1.r_name, COUNT(T2.n_name) AS num FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey GROUP BY T1.r_name ) AS T ORDER BY T.num LIMIT 1",
"index": 3205,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nregion refers to has r_name; the lowest number of countries refers to min(count(n_name))\nWhich region has the lowest number of countries?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['IRAQ', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['FURNITURE', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfurniture segment refers to c_mktsegment = 'FURNITURE'; Iraq refers to n_name = 'Iraq'\nHow many customers from the furniture segments come from Iraq?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'FURNITURE' AND T2.n_name = 'IRAQ'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T1.c_custkey) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey WHERE T1.c_mktsegment = 'FURNITURE' AND T2.n_name = 'IRAQ'",
"index": 3206,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['IRAQ', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['FURNITURE', 'BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nfurniture segment refers to c_mktsegment = 'FURNITURE'; Iraq refers to n_name = 'Iraq'\nHow many customers from the furniture segments come from Iraq?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['violet olive rose ivory sandy', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupply cost refers to ps_supplycost; part \"violet olive rose ivory sandy\" refers to p_name = 'violet olive rose ivory sandy'\nWhat is the supply cost for the part \"violet olive rose ivory sandy\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'violet olive rose ivory sandy'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'violet olive rose ivory sandy'",
"index": 3207,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['violet olive rose ivory sandy', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupply cost refers to ps_supplycost; part \"violet olive rose ivory sandy\" refers to p_name = 'violet olive rose ivory sandy'\nWhat is the supply cost for the part \"violet olive rose ivory sandy\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnation refers to n_name; account balance of \"4393.04\" refers to s_acctbal = 4393.04\nWhich nation does the supplier with the account balance of \"4393.04\" belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal = 4393.04",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal = 4393.04",
"index": 3208,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnation refers to n_name; account balance of \"4393.04\" refers to s_acctbal = 4393.04\nWhich nation does the supplier with the account balance of \"4393.04\" belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnation refers to n_name; the lowest account balance refers to min(s_acctbal)\nWhat are the top 5 nations of suppliers with the lowest account balance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey ORDER BY T1.s_acctbal LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey ORDER BY T1.s_acctbal LIMIT 1",
"index": 3209,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnation refers to n_name; the lowest account balance refers to min(s_acctbal)\nWhat are the top 5 nations of suppliers with the lowest account balance?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddresses refers to s_address; the biggest part refers to max(p_size)\nList all the addresses for the suppliers of the biggest parts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_address FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey ORDER BY T3.p_size DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.s_address FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey ORDER BY T3.p_size DESC LIMIT 1",
"index": 3210,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naddresses refers to s_address; the biggest part refers to max(p_size)\nList all the addresses for the suppliers of the biggest parts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder key refers to l_orderkey; not applied for the discount refers to l_discount = 0\nHow many order keys are not applied for the discount?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(l_orderkey) FROM lineitem WHERE l_discount = 0",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(l_orderkey) FROM lineitem WHERE l_discount = 0",
"index": 3211,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder key refers to l_orderkey; not applied for the discount refers to l_discount = 0\nHow many order keys are not applied for the discount?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ARGENTINA', 'ALGERIA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArgentina refers to n_name = 'ARGENTINA'; supplier refers to s_name; an account in debt refers to s_acctbal < 0\nAmong the providers in Argentina, which supplier has an account that is in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'ARGENTINA'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.s_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 AND T2.n_name = 'ARGENTINA'",
"index": 3212,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ARGENTINA', 'ALGERIA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nArgentina refers to n_name = 'ARGENTINA'; supplier refers to s_name; an account in debt refers to s_acctbal < 0\nAmong the providers in Argentina, which supplier has an account that is in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe algeria region refers to r_name = 'ALGERIA'\nHow many countries belong to the Algeria region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.r_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T2.n_name = 'ALGERIA'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T1.r_name) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey WHERE T2.n_name = 'ALGERIA'",
"index": 3213,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe algeria region refers to r_name = 'ALGERIA'\nHow many countries belong to the Algeria region?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['PROMO BRUSHED STEEL', 'LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct name refers to p_name; type \"promo brushed steel\" refers to p_type = 'PROMO BRUSHED STEEL'\nPlease list the names of all the products under the type \"promo brushed steel\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT p_name FROM part WHERE p_type = 'PROMO BRUSHED STEEL'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT p_name FROM part WHERE p_type = 'PROMO BRUSHED STEEL'",
"index": 3214,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['PROMO BRUSHED STEEL', 'LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nproduct name refers to p_name; type \"promo brushed steel\" refers to p_type = 'PROMO BRUSHED STEEL'\nPlease list the names of all the products under the type \"promo brushed steel\".\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomment refers to p_comment; product \"burlywood plum powder puff mint\" refers to p_name = 'burlywood plum powder puff mint'\nWhat is the comment of the product \"burlywood plum powder puff mint\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT p_comment FROM part WHERE p_name = 'burlywood plum powder puff mint'",
"index": 3215,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncomment refers to p_comment; product \"burlywood plum powder puff mint\" refers to p_name = 'burlywood plum powder puff mint'\nWhat is the comment of the product \"burlywood plum powder puff mint\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na retail price of over 1900 refers to p_retailprice > 1900\nHow many parts have a retail price of over 1900?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(p_partkey) FROM part WHERE p_retailprice > 1900",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(p_partkey) FROM part WHERE p_retailprice > 1900",
"index": 3216,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\na retail price of over 1900 refers to p_retailprice > 1900\nHow many parts have a retail price of over 1900?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['cornflower sky burlywood green beige', 'pink powder drab lawn cyan', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsize refers to p_size; \"pink powder drab lawn cyan\" or \"cornflower sky burlywood green beige\" refers to p_name in ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige')\nWhich part has a bigger size, \"pink powder drab lawn cyan\" or \"cornflower sky burlywood green beige\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_name FROM ( SELECT p_name, p_size FROM part WHERE p_name IN ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige') ) AS T ORDER BY p_size DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T.p_name FROM ( SELECT p_name, p_size FROM part WHERE p_name IN ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige') ) AS T ORDER BY p_size DESC LIMIT 1",
"index": 3217,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['cornflower sky burlywood green beige', 'pink powder drab lawn cyan', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsize refers to p_size; \"pink powder drab lawn cyan\" or \"cornflower sky burlywood green beige\" refers to p_name in ('pink powder drab lawn cyan', 'cornflower sky burlywood green beige')\nWhich part has a bigger size, \"pink powder drab lawn cyan\" or \"cornflower sky burlywood green beige\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['JUMBO CASE', 'JUMBO CAN', 'LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njumbo case container refers to p_container = 'JUMBO CASE'\nHow many parts have a jumbo case container?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(p_partkey) FROM part WHERE p_container = 'JUMBO CASE'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(p_partkey) FROM part WHERE p_container = 'JUMBO CASE'",
"index": 3218,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['JUMBO CASE', 'JUMBO CAN', 'LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\njumbo case container refers to p_container = 'JUMBO CASE'\nHow many parts have a jumbo case container?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['JUMBO CASE', 'JUMBO CAN', 'LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsize refers to p_size; the smallest part refers to min(p_size); jumbo case container refers to p_container = 'JUMBO CASE'\nWhat is the size of the smallest part in a jumbo case container?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(p_size) FROM part WHERE p_container = 'JUMBO CASE'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT MIN(p_size) FROM part WHERE p_container = 'JUMBO CASE'",
"index": 3219,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['JUMBO CASE', 'JUMBO CAN', 'LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsize refers to p_size; the smallest part refers to min(p_size); jumbo case container refers to p_container = 'JUMBO CASE'\nWhat is the size of the smallest part in a jumbo case container?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupplier name refers to s_name; the most amount of money refers to max(s_acctbal)\nPlease list the names of the top 3 suppliers with the most amount of money in their accounts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT s_name FROM supplier ORDER BY s_acctbal DESC LIMIT 3",
"index": 3220,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nsupplier name refers to s_name; the most amount of money refers to max(s_acctbal)\nPlease list the names of the top 3 suppliers with the most amount of money in their accounts.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\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 s_phone; Germany refers to n_name = 'Germany'\nPlease list the phone numbers of all the suppliers in Germany.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.s_phone FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'Germany'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.s_phone FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T2.n_name = 'Germany'",
"index": 3221,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['GERMANY', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\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 s_phone; Germany refers to n_name = 'Germany'\nPlease list the phone numbers of all the suppliers in Germany.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal quantity available refers to sum(ps_availqty); part \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'\nWhat is the total quantity available by all suppliers for the part \"hot spring dodger dim light\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T1.ps_availqty) FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T2.p_name = 'hot spring dodger dim light'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT SUM(T1.ps_availqty) FROM partsupp AS T1 INNER JOIN part AS T2 ON T1.ps_partkey = T2.p_partkey WHERE T2.p_name = 'hot spring dodger dim light'",
"index": 3222,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal quantity available refers to sum(ps_availqty); part \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'\nWhat is the total quantity available by all suppliers for the part \"hot spring dodger dim light\"?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most number refers to max(ps_availqty); \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'; phone number refers to s_phone\nWhich supplier can provide the most number of \"hot spring dodger dim light\"? Please give the supplier's phone number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T3.s_phone FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'hot spring dodger dim light' ORDER BY T2.ps_availqty DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T3.s_phone FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_name = 'hot spring dodger dim light' ORDER BY T2.ps_availqty DESC LIMIT 1",
"index": 3223,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nthe most number refers to max(ps_availqty); \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'; phone number refers to s_phone\nWhich supplier can provide the most number of \"hot spring dodger dim light\"? Please give the supplier's phone number.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['VIETNAM', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'; Vietnam refers to n_name = 'VIETNAM'\nHow many suppliers for the part \"hot spring dodger dim light\" are in Vietnam?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey INNER JOIN nation AS T4 ON T3.s_nationkey = T4.n_nationkey WHERE T1.p_name = 'hot spring dodger dim light' AND T4.n_name = 'VIETNAM'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey INNER JOIN nation AS T4 ON T3.s_nationkey = T4.n_nationkey WHERE T1.p_name = 'hot spring dodger dim light' AND T4.n_name = 'VIETNAM'",
"index": 3224,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['VIETNAM', 'ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'; Vietnam refers to n_name = 'VIETNAM'\nHow many suppliers for the part \"hot spring dodger dim light\" are in Vietnam?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['PROMO BRUSHED STEEL', 'LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype \"promo brushed steel\" refers to p_type = 'PROMO BRUSHED STEEL'; in debt refers to s_acctbal < 0\nAmong the suppliers providing parts under the type \"promo brushed steel\", how many of them are in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T3.s_acctbal < 0 AND T1.p_type = 'PROMO BRUSHED STEEL'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T3.s_name) FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T3.s_acctbal < 0 AND T1.p_type = 'PROMO BRUSHED STEEL'",
"index": 3225,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['PROMO BRUSHED STEEL', 'LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype \"promo brushed steel\" refers to p_type = 'PROMO BRUSHED STEEL'; in debt refers to s_acctbal < 0\nAmong the suppliers providing parts under the type \"promo brushed steel\", how many of them are in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['PROMO BRUSHED STEEL', 'LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype \"promo brushed steel\" refers to p_type = 'PROMO BRUSHED STEEL'; a total available quantity of under 5000 refers to sum(ps_availqty) < 5000\nAmong all the parts under the type \"promo brushed steel\", how many of them have a total available quantity from all suppliers of under 5000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(num) FROM ( SELECT COUNT(T3.s_name) AS num FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_type = 'PROMO BRUSHED STEEL' GROUP BY T2.ps_partkey HAVING SUM(T2.ps_availqty) < 5000 ) T",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT SUM(num) FROM ( SELECT COUNT(T3.s_name) AS num FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey INNER JOIN supplier AS T3 ON T2.ps_suppkey = T3.s_suppkey WHERE T1.p_type = 'PROMO BRUSHED STEEL' GROUP BY T2.ps_partkey HAVING SUM(T2.ps_availqty) < 5000 ) T",
"index": 3226,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['PROMO BRUSHED STEEL', 'LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntype \"promo brushed steel\" refers to p_type = 'PROMO BRUSHED STEEL'; a total available quantity of under 5000 refers to sum(ps_availqty) < 5000\nAmong all the parts under the type \"promo brushed steel\", how many of them have a total available quantity from all suppliers of under 5000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'\nThe part \"hot spring dodger dim light\" is ordered in how many orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT COUNT(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T1.p_partkey) FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_name = 'hot spring dodger dim light'",
"index": 3227,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'\nThe part \"hot spring dodger dim light\" is ordered in how many orders?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['JUMBO CASE', 'JUMBO CAN', 'LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder key refers to l_orderkey; jumbo case container refers to p_container = 'JUMBO CASE'; more than 2 parts refers to count(l_partkey) > 2\nPlease list the order keys of all the orders that have more than 2 parts with a jumbo case container.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_orderkey FROM ( SELECT T2.l_orderkey, COUNT(T2.l_partkey) AS num FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_container = 'JUMBO CASE' GROUP BY T2.l_orderkey ) AS T WHERE T.num > 2",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T.l_orderkey FROM ( SELECT T2.l_orderkey, COUNT(T2.l_partkey) AS num FROM part AS T1 INNER JOIN lineitem AS T2 ON T1.p_partkey = T2.l_partkey WHERE T1.p_container = 'JUMBO CASE' GROUP BY T2.l_orderkey ) AS T WHERE T.num > 2",
"index": 3228,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['JUMBO CASE', 'JUMBO CAN', 'LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder key refers to l_orderkey; jumbo case container refers to p_container = 'JUMBO CASE'; more than 2 parts refers to count(l_partkey) > 2\nPlease list the order keys of all the orders that have more than 2 parts with a jumbo case container.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin debt refers to s_acctbal < 0; Europe refers to r_name = 'EUROPE'\nAmong all the suppliers in debt, how many of them are in Europe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE' AND T3.s_acctbal < 0",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T1.n_nationkey) FROM nation AS T1 INNER JOIN region AS T2 ON T1.n_regionkey = T2.r_regionkey INNER JOIN supplier AS T3 ON T1.n_nationkey = T3.s_nationkey WHERE T2.r_name = 'EUROPE' AND T3.s_acctbal < 0",
"index": 3229,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nin debt refers to s_acctbal < 0; Europe refers to r_name = 'EUROPE'\nAmong all the suppliers in debt, how many of them are in Europe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = hot spring dodger dim light; Europe refers to r_name = 'EUROPE'\nAmong all the suppliers providing the part \"hot spring dodger dim light\", how many of them are in Europe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.r_regionkey) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey WHERE T1.r_name = 'EUROPE'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T1.r_regionkey) FROM region AS T1 INNER JOIN nation AS T2 ON T1.r_regionkey = T2.n_regionkey INNER JOIN supplier AS T3 ON T2.n_nationkey = T3.s_nationkey WHERE T1.r_name = 'EUROPE'",
"index": 3230,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['EUROPE', 'AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = hot spring dodger dim light; Europe refers to r_name = 'EUROPE'\nAmong all the suppliers providing the part \"hot spring dodger dim light\", how many of them are in Europe?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder no.4 refers to l_orderkey = 4; in debt refers to s_acctbal < 0\nAmong the suppliers for the parts ordered in order no.4, how many of them are in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_linenumber) FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_orderkey = 4 AND T2.s_acctbal < 0",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(T1.l_linenumber) FROM lineitem AS T1 INNER JOIN supplier AS T2 ON T1.l_suppkey = T2.s_suppkey WHERE T1.l_orderkey = 4 AND T2.s_acctbal < 0",
"index": 3231,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\norder no.4 refers to l_orderkey = 4; in debt refers to s_acctbal < 0\nAmong the suppliers for the parts ordered in order no.4, how many of them are in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['SHIP', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate refers to l_shipdate; part \"burnished seashell gainsboro navajo chocolate\" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1\nOn which date was the part \"burnished seashell gainsboro navajo chocolate\" in order no.1 shipped?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_shipdate FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T1.l_orderkey = 1 AND T2.p_name = 'burnished seashell gainsboro navajo chocolate'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.l_shipdate FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T1.l_orderkey = 1 AND T2.p_name = 'burnished seashell gainsboro navajo chocolate'",
"index": 3232,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['SHIP', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndate refers to l_shipdate; part \"burnished seashell gainsboro navajo chocolate\" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1\nOn which date was the part \"burnished seashell gainsboro navajo chocolate\" in order no.1 shipped?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'; percentage = divide(subtract(max(ps_supplycost), min(ps_supplycost)), min(ps_supplycost)) * 100%\nHow much higher in percentage is the highest supply cost of the part \"hot spring dodger dim light\" than the lowest supply cost?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT CAST((MAX(T1.ps_supplycost) - MIN(T1.ps_supplycost)) AS REAL) * 100 / MIN(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT CAST((MAX(T1.ps_supplycost) - MIN(T1.ps_supplycost)) AS REAL) * 100 / MIN(T1.ps_supplycost) FROM partsupp AS T1 INNER JOIN supplier AS T2 ON T1.ps_suppkey = T2.s_suppkey INNER JOIN part AS T3 ON T1.ps_partkey = T3.p_partkey WHERE T3.p_name = 'hot spring dodger dim light'",
"index": 3233,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['hot spring dodger dim light', 'burlywood plum powder puff mint']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"hot spring dodger dim light\" refers to p_name = 'hot spring dodger dim light'; percentage = divide(subtract(max(ps_supplycost), min(ps_supplycost)), min(ps_supplycost)) * 100%\nHow much higher in percentage is the highest supply cost of the part \"hot spring dodger dim light\" than the lowest supply cost?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart no.98768 refers to l_partkey = 98768; order no.1 refers to l_orderkey = 1; profit = subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))\nWhat is the profit for part no.98768 in order no.1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_orderkey = 1 AND T1.l_partkey = 98768",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.l_extendedprice * (1 - T1.l_discount) - T2.ps_supplycost * T1.l_quantity FROM lineitem AS T1 INNER JOIN partsupp AS T2 ON T1.l_suppkey = T2.ps_suppkey WHERE T1.l_orderkey = 1 AND T1.l_partkey = 98768",
"index": 3234,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart no.98768 refers to l_partkey = 98768; order no.1 refers to l_orderkey = 1; profit = subtract(multiply(l_extendedprice, subtract(1, l_discount)), multiply(ps_supplycost, l_quantity))\nWhat is the profit for part no.98768 in order no.1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"burnished seashell gainsboro navajo chocolate\" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1; discounted price refers to multiply(l_extendedprice, subtract(1, l_discount))\nWhat is the discounted price of the part \"burnished seashell gainsboro navajo chocolate\" in order no.1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.l_extendedprice * (1 - T1.l_discount) FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name = 'burnished seashell gainsboro navajo chocolate' AND T1.l_orderkey = 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.l_extendedprice * (1 - T1.l_discount) FROM lineitem AS T1 INNER JOIN part AS T2 ON T1.l_partkey = T2.p_partkey WHERE T2.p_name = 'burnished seashell gainsboro navajo chocolate' AND T1.l_orderkey = 1",
"index": 3235,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart \"burnished seashell gainsboro navajo chocolate\" refers to p_name = 'burnished seashell gainsboro navajo chocolate'; order no.1 refers to l_orderkey = 1; discounted price refers to multiply(l_extendedprice, subtract(1, l_discount))\nWhat is the discounted price of the part \"burnished seashell gainsboro navajo chocolate\" in order no.1?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarket segment refers to c_mktsegment; the highest amount of debt refers to max(c_acctbal)\nWhich market segment does the customer with the highest amount of debt belongs to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT c_mktsegment FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT c_mktsegment FROM customer WHERE c_acctbal = ( SELECT MIN(c_acctbal) FROM customer )",
"index": 3236,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmarket segment refers to c_mktsegment; the highest amount of debt refers to max(c_acctbal)\nWhich market segment does the customer with the highest amount of debt belongs to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['MAIL', 'SHIP', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1997 refers to year(l_shipdate) = 1997; shipped via mail refers to l_shipmode = 'MAIL'\nIn 1997, how many orders were shipped via mail?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1997' AND l_shipmode = 'MAIL'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%Y', l_shipdate) = '1997' AND l_shipmode = 'MAIL'",
"index": 3237,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['MAIL', 'SHIP', 'RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1997 refers to year(l_shipdate) = 1997; shipped via mail refers to l_shipmode = 'MAIL'\nIn 1997, how many orders were shipped via mail?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['MACHINERY', 'BUILDING']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmachinery segment refers to c_mktsegment = 'MACHINERY'; in debt refers to c_acctbal < 0\nHow many customers in the machinery segment are in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(c_custkey) FROM customer WHERE c_acctbal < 0 AND c_mktsegment = 'MACHINERY'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0 AND c_mktsegment = 'MACHINERY'",
"index": 3238,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['MACHINERY', 'BUILDING']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmachinery segment refers to c_mktsegment = 'MACHINERY'; in debt refers to c_acctbal < 0\nHow many customers in the machinery segment are in debt?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000001', 'Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nurgent order refers to o_orderpriority = '1-URGENT'; Clerk#000000001 refers to o_clerk = 'Clerk#000000001'; 1997 refers to year(o_orderdate) = 1997\nHow many urgent orders did Clerk#000000001 handle in 1997?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(o_orderkey) FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1997' AND o_clerk = 'Clerk#000000001' AND o_orderpriority = '1-URGENT'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT COUNT(o_orderkey) FROM orders WHERE STRFTIME('%Y', o_orderdate) = '1997' AND o_clerk = 'Clerk#000000001' AND o_orderpriority = '1-URGENT'",
"index": 3239,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['1-URGENT', '4-NOT SPECIFIED']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000001', 'Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nurgent order refers to o_orderpriority = '1-URGENT'; Clerk#000000001 refers to o_clerk = 'Clerk#000000001'; 1997 refers to year(o_orderdate) = 1997\nHow many urgent orders did Clerk#000000001 handle in 1997?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\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 customer refers to c_name; delivered the longest refers to max(subtract(l_receiptdate, l_commitdate))\nWhat is the name of the customer whose order was delivered the longest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.c_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN customer AS T3 ON T1.o_custkey = T3.c_custkey ORDER BY (JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate)) DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T3.c_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN customer AS T3 ON T1.o_custkey = T3.c_custkey ORDER BY (JULIANDAY(T2.l_receiptdate) - JULIANDAY(T2.l_commitdate)) DESC LIMIT 1",
"index": 3240,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\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 customer refers to c_name; delivered the longest refers to max(subtract(l_receiptdate, l_commitdate))\nWhat is the name of the customer whose order was delivered the longest?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ARGENTINA', 'ALGERIA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price = sum(o_totalprice); Argentina refers to n_name = 'Argentina'\nHow much is the total price of all the orders shipped to customers in Argentina?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.o_totalprice) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'ARGENTINA'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT SUM(T3.o_totalprice) FROM customer AS T1 INNER JOIN nation AS T2 ON T1.c_nationkey = T2.n_nationkey INNER JOIN orders AS T3 ON T1.c_custkey = T3.o_custkey WHERE T2.n_name = 'ARGENTINA'",
"index": 3241,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ARGENTINA', 'ALGERIA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntotal price = sum(o_totalprice); Argentina refers to n_name = 'Argentina'\nHow much is the total price of all the orders shipped to customers in Argentina?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to n_name; the least number of suppliers refers to min(count(s_name))\nWhich country has the least number of suppliers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey GROUP BY T1.s_nationkey ORDER BY COUNT(T1.s_name) LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.n_name FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey GROUP BY T1.s_nationkey ORDER BY COUNT(T1.s_name) LIMIT 1",
"index": 3242,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to n_name; the least number of suppliers refers to min(count(s_name))\nWhich country has the least number of suppliers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['medium metallic grey dodger linen', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart supply cost refers to ps_supplycost; medium metallic grey dodger linen refers to p_name = 'medium metallic grey dodger linen'\nHow much is the part supply cost for the medium metallic grey dodger linen?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'medium metallic grey dodger linen'",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.ps_supplycost FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T1.p_name = 'medium metallic grey dodger linen'",
"index": 3243,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['medium metallic grey dodger linen', 'burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npart supply cost refers to ps_supplycost; medium metallic grey dodger linen refers to p_name = 'medium metallic grey dodger linen'\nHow much is the part supply cost for the medium metallic grey dodger linen?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to c_name; highest number of indebted refers to max(sum(acctbal)) where s_acctbal < 0\nWhat are the top 2 countries with the highest number of indebted suppliers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.n_name FROM ( SELECT T2.n_name, SUM(T1.s_acctbal) AS num FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 GROUP BY T1.s_nationkey ) AS T ORDER BY T.num LIMIT 2",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T.n_name FROM ( SELECT T2.n_name, SUM(T1.s_acctbal) AS num FROM supplier AS T1 INNER JOIN nation AS T2 ON T1.s_nationkey = T2.n_nationkey WHERE T1.s_acctbal < 0 GROUP BY T1.s_nationkey ) AS T ORDER BY T.num LIMIT 2",
"index": 3244,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry refers to c_name; highest number of indebted refers to max(sum(acctbal)) where s_acctbal < 0\nWhat are the top 2 countries with the highest number of indebted suppliers?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\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 part refers to p_name; part supply cost of at least 1,000 refers to ps_supplycost > 1000\nWhat are the names of the parts that have a part supply cost of at least 1,000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_supplycost > 1000",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.p_name FROM part AS T1 INNER JOIN partsupp AS T2 ON T1.p_partkey = T2.ps_partkey WHERE T2.ps_supplycost > 1000",
"index": 3245,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_shipdate date, -- line item ship date, example: ['1995-08-16', '1995-08-13']\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_receiptdate date, -- line item receipt date, example: ['1995-09-14', '1995-08-27']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_size integer, -- part size, example: [31, 4]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_retailprice real, -- part retail price, example: [901.0, 902.0]\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\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 part refers to p_name; part supply cost of at least 1,000 refers to ps_supplycost > 1000\nWhat are the names of the parts that have a part supply cost of at least 1,000?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclerk refers to o_clerk; the highest amount of extended price refers to max(l_extendedprice)\nWho is the clerk in charge of handling the item with the highest amount of extended 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.o_clerk FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T2.l_extendedprice DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T1.o_clerk FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey ORDER BY T2.l_extendedprice DESC LIMIT 1",
"index": 3246,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n PRIMARY KEY (p_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE orders (\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nclerk refers to o_clerk; the highest amount of extended price refers to max(l_extendedprice)\nWho is the clerk in charge of handling the item with the highest amount of extended 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 lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\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 part refers to p_name; customer 110942 refers to o_custkey = 110942\nWhat are the names of the parts that were ordered by customer 110942?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 110942",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 110942",
"index": 3247,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_quantity integer, -- line item quantity, example: [33, 10]\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_linestatus text, -- line item line status, example: ['O', 'F']\n l_tax real, -- line item tax, example: [0.06, 0.08]\n l_commitdate date, -- line item commit date, example: ['1995-07-12', '1995-07-09']\n l_linenumber integer, -- line item line number, example: [1, 2]\n l_shipinstruct text, -- line item ship instruct, example: ['NONE', 'TAKE BACK RETURN']\n l_comment text, -- line item comment, example: ['carefully bo', 'blithely regular pac']\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_name text, -- region name, example: ['AFRICA', 'AMERICA']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_comment text, -- supplier comment, example: ['blithely final pearls are. instructions ', 'requests integrate fluffily. fluffily ir']\n s_address text, -- supplier address, example: [',wWs4pnykQOFl8mgVCU8EZMXqZs1w', 'WkXT6MSAJrp4qWq3W9N']\n s_phone text, -- supplier phone, example: ['800-807-9579', '348-617-6055']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_orderpriority text, -- order priority, example: ['4-NOT SPECIFIED', '1-URGENT']\n o_shippriority integer, -- order ship priority, example: [0]\n o_clerk text, -- order clerk, example: ['Clerk#000000916', 'Clerk#000000373']\n o_orderstatus text, -- order status, example: ['P', 'O']\n o_totalprice real, -- order total price, example: [203198.56, 317719.99]\n o_comment text, -- order comment, example: ['final packages sleep blithely packa', 'final excuses about the ironic even depo']\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_name text, -- nation name, example: ['ALGERIA', 'ARGENTINA']\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_mktsegment text, -- customer market segment, example: ['BUILDING', 'MACHINERY']\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_address text, -- customer address, example: ['KwX3hMHjZ6', 'ioUn,eqTTXOdo']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n c_comment text, -- customer comment, example: ['ironic excuses detect slyly silent reque', 'final express accounts mold slyly. ironi']\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_type text, -- part type, example: ['LARGE PLATED TIN', 'LARGE POLISHED STEEL']\n p_brand text, -- part brand, example: ['Brand#43', 'Brand#55']\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_container text, -- part container, example: ['LG BAG', 'LG CASE']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\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 part refers to p_name; customer 110942 refers to o_custkey = 110942\nWhat are the names of the parts that were ordered by customer 110942?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiscounted price refers to multiply(l_extendedprice, subtract(1, l_discount)); customer 111511 refers to o_custkey = 111511; order 53159 refers to o_orderkey = 53159; name of the part refers to p_name\nHow much is the discounted price of every item that customer 111511 ordered in order 53159? List the names of the parts of every item.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.l_extendedprice * (1 - T2.l_discount), T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 111511 AND T1.o_orderkey = 53159",
"style": "rule"
} | {
"db_id": "retails.sqlite",
"gt_sql": "SELECT T2.l_extendedprice * (1 - T2.l_discount), T3.p_name FROM orders AS T1 INNER JOIN lineitem AS T2 ON T1.o_orderkey = T2.l_orderkey INNER JOIN part AS T3 ON T2.l_partkey = T3.p_partkey WHERE T1.o_custkey = 111511 AND T1.o_orderkey = 53159",
"index": 3248,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE region (\n r_regionkey integer, -- region key, example: [0, 1]\n r_comment text, -- region comment, example: ['asymptotes sublate after the r', 'requests affix quickly final tithes. bli']\n PRIMARY KEY (r_regionkey)\n);\n\nCREATE TABLE partsupp (\n ps_partkey integer, -- part supply part key, example: [1, 2]\n ps_suppkey integer, -- part supply supply key, example: [2, 2502]\n ps_supplycost real, -- part supply cost, example: [400.75, 702.61]\n ps_availqty integer, -- part supply available quantity, example: [1111, 3999]\n ps_comment text, -- part supply comment, example: ['carefully ironic deposits use against th', 'slyly regular accounts serve carefully. ']\n PRIMARY KEY (ps_partkey, ps_suppkey),\n CONSTRAINT fk_partsupp_ps_partkey FOREIGN KEY (ps_partkey) REFERENCES part (p_partkey),\n CONSTRAINT fk_partsupp_ps_suppkey FOREIGN KEY (ps_suppkey) REFERENCES supplier (s_suppkey)\n);\n\nCREATE TABLE orders (\n o_orderdate date, -- order date, example: ['1995-04-19', '1996-11-04']\n o_orderkey integer, -- order key, example: [1, 2]\n o_custkey integer, -- order customer key, example: [73100, 92861]\n o_shippriority integer, -- order ship priority, example: [0]\n PRIMARY KEY (o_orderkey),\n CONSTRAINT fk_orders_o_custkey FOREIGN KEY (o_custkey) REFERENCES customer (c_custkey)\n);\n\nCREATE TABLE lineitem (\n l_orderkey integer, -- line item order key, example: [1, 2]\n l_discount real, -- line item discount, example: [0.1, 0.09]\n l_extendedprice real, -- line item extended price, example: [58303.08, 16947.7]\n l_suppkey integer, -- line item suppkey, example: [6296, 8776]\n l_returnflag text, -- line item return flag, example: ['N', 'A']\n l_partkey integer, -- line item part key, example: [98768, 23771]\n l_shipmode text, -- line item ship mode, example: ['RAIL', 'TRUCK']\n l_linenumber integer, -- line item line number, example: [1, 2]\n PRIMARY KEY (l_orderkey, l_linenumber),\n CONSTRAINT fk_lineitem_l_orderkey FOREIGN KEY (l_orderkey) REFERENCES orders (o_orderkey),\n CONSTRAINT fk_lineitem_l_suppkey FOREIGN KEY (l_suppkey) REFERENCES partsupp (ps_suppkey),\n CONSTRAINT fk_lineitem_l_partkey FOREIGN KEY (l_partkey) REFERENCES partsupp (ps_partkey)\n);\n\nCREATE TABLE nation (\n n_nationkey integer, -- nation key, example: [0, 1]\n n_regionkey integer, -- nation region key, example: [0, 1]\n n_comment text, -- nation comment, example: ['slyly express pinto beans cajole idly. d', 'instructions detect blithely stealthily ']\n PRIMARY KEY (n_nationkey),\n CONSTRAINT fk_nation_n_regionkey FOREIGN KEY (n_regionkey) REFERENCES region (r_regionkey)\n);\n\nCREATE TABLE supplier (\n s_suppkey integer, -- supply key, example: [1, 2]\n s_nationkey integer, -- supplier nation key, example: [13, 5]\n s_name text, -- supplier name, example: ['Supplier#000000001', 'Supplier#000000002']\n s_acctbal real, -- supplier account balance, example: [3082.86, 3009.73]\n PRIMARY KEY (s_suppkey),\n CONSTRAINT fk_supplier_s_nationkey FOREIGN KEY (s_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE customer (\n c_custkey integer, -- customer key, example: [1, 2]\n c_nationkey integer, -- customer nation key, example: [8, 16]\n c_name text, -- customer name, example: ['Customer#000000001', 'Customer#000000002']\n c_phone text, -- customer phone, example: ['937-241-3198', '906-965-7556']\n c_acctbal real, -- customer account balance, example: [3560.03, 7550.21]\n PRIMARY KEY (c_custkey),\n CONSTRAINT fk_customer_c_nationkey FOREIGN KEY (c_nationkey) REFERENCES nation (n_nationkey)\n);\n\nCREATE TABLE part (\n p_partkey integer, -- part key, example: [1, 2]\n p_name text, -- part name, example: ['burlywood plum powder puff mint', 'hot spring dodger dim light']\n p_mfgr text, -- part manufacturer, example: ['Manufacturer#4', 'Manufacturer#5']\n p_comment text, -- part comment, example: ['blithely busy reque', 'even ironic requests s']\n PRIMARY KEY (p_partkey)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndiscounted price refers to multiply(l_extendedprice, subtract(1, l_discount)); customer 111511 refers to o_custkey = 111511; order 53159 refers to o_orderkey = 53159; name of the part refers to p_name\nHow much is the discounted price of every item that customer 111511 ordered in order 53159? List the names of the parts of every item.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweigh in kilograms refers to weight_in_kg;\nHow much does David Bornhammar weigh in kilograms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'David Bornhammar'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'David Bornhammar'",
"index": 3249,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweigh in kilograms refers to weight_in_kg;\nHow much does David Bornhammar weigh in kilograms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweigh more than 90 kg refers to weight_in_kg > 90; position of defense refers to position_info = 'D' ;\nAmong the players that weigh more than 90 kg, how many of them have a position of defense?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND T1.position_info = 'D'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND T1.position_info = 'D'",
"index": 3250,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweigh more than 90 kg refers to weight_in_kg > 90; position of defense refers to position_info = 'D' ;\nAmong the players that weigh more than 90 kg, how many of them have a position of defense?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['R', 'L']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; over 90 kg refers to weight_in_kg > 90; right-shooted refers to shoots = 'R';\nPlease list the names of all the players that are over 90 kg and are right-shooted.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND T1.shoots = 'R'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_kg > 90 AND T1.shoots = 'R'",
"index": 3251,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['R', 'L']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; over 90 kg refers to weight_in_kg > 90; right-shooted refers to shoots = 'R';\nPlease list the names of all the players that are over 90 kg and are right-shooted.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_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 = AVG(height_in_cm); players refers to PlayerName; position of defense refers to position_info = 'D' ;\nWhat is the average height in centimeters of all the players in the position of defense?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.height_in_cm) AS REAL) / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.position_info = 'D'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT CAST(SUM(T2.height_in_cm) AS REAL) / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN height_info AS T2 ON T1.height = T2.height_id WHERE T1.position_info = 'D'",
"index": 3252,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_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 = AVG(height_in_cm); players refers to PlayerName; position of defense refers to position_info = 'D' ;\nWhat is the average height in centimeters of all the players in the position of defense?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweight in pounds refers to weight_in_lbs; heaviest player refers to MAX(weight_in_lbs);\nWhat is the weight in pounds of the heaviest player?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT MAX(T2.weight_in_lbs) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT MAX(T2.weight_in_lbs) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id",
"index": 3253,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nweight in pounds refers to weight_in_lbs; heaviest player refers to MAX(weight_in_lbs);\nWhat is the weight in pounds of the heaviest player?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_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 NHL games played in their first 7 years of NHL career is no less than 500 refers to sum_7yr_GP > 500; name of the player refers to PlayerName; committed the most rule violations refers to MAX(PIM);\nAmong the players whose total NHL games played in their first 7 years of NHL career is no less than 500, what is the name of the player who committed the most rule violations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.sum_7yr_GP > 500 ORDER BY T2.PIM DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.sum_7yr_GP > 500 ORDER BY T2.PIM DESC LIMIT 1",
"index": 3254,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_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 NHL games played in their first 7 years of NHL career is no less than 500 refers to sum_7yr_GP > 500; name of the player refers to PlayerName; committed the most rule violations refers to MAX(PIM);\nAmong the players whose total NHL games played in their first 7 years of NHL career is no less than 500, what is the name of the player who committed the most rule violations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1998-1999', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Acadie-Bathurst Titan', 'Rimouski Oceanic', 'Canada U20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; played for Acadie-Bathurst Titan refers to TEAM = 'AcadieandBathurst Titan'; regular season refers to GAMETYPE = 'Regular Season'; in 1998-1999 refers to SEASON = '1998-1999';\nWhat are the names of the players who played for Acadie-Bathurst Titan during the regular season in 1998-1999?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1998-1999' AND T1.GAMETYPE = 'Regular Season' AND T1.TEAM = 'Acadie-Bathurst Titan'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1998-1999' AND T1.GAMETYPE = 'Regular Season' AND T1.TEAM = 'Acadie-Bathurst Titan'",
"index": 3255,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1998-1999', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Acadie-Bathurst Titan', 'Rimouski Oceanic', 'Canada U20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; played for Acadie-Bathurst Titan refers to TEAM = 'AcadieandBathurst Titan'; regular season refers to GAMETYPE = 'Regular Season'; in 1998-1999 refers to SEASON = '1998-1999';\nWhat are the names of the players who played for Acadie-Bathurst Titan during the regular season in 1998-1999?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed 72 games refers to GP = 72; left-shooters refers to shoots = 'L';\nAmong the players who played 72 games, how many are left-shooters?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ELITEID) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.GP = 72 AND T2.shoots = 'L'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT COUNT(T2.ELITEID) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.GP = 72 AND T2.shoots = 'L'",
"index": 3256,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayed 72 games refers to GP = 72; left-shooters refers to shoots = 'L';\nAmong the players who played 72 games, how many are left-shooters?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = AVG(weight_in_lbs); weight in pounds refers to weight_in_lbs; players refers to PlayerName; highest prospects for the draft refers to MAX(CSS_rank);\nWhat is the average weight in pounds of all the players with the highest prospects for the draft?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight_in_lbs) AS REAL) / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.CSS_rank = ( SELECT MAX(CSS_rank) FROM PlayerInfo )",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT CAST(SUM(T2.weight_in_lbs) AS REAL) / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.CSS_rank = ( SELECT MAX(CSS_rank) FROM PlayerInfo )",
"index": 3257,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\naverage = AVG(weight_in_lbs); weight in pounds refers to weight_in_lbs; players refers to PlayerName; highest prospects for the draft refers to MAX(CSS_rank);\nWhat is the average weight in pounds of all the players with the highest prospects for the draft?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Brian Gionta', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayers refers to PlayerName; height refers to height_in_cm;\nIdentify the players with the same height as Brian Gionta. How tall are they?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName, T1.height_in_cm FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.height = ( SELECT height FROM PlayerInfo WHERE PlayerName = 'Brian Gionta' )",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName, T1.height_in_cm FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.height = ( SELECT height FROM PlayerInfo WHERE PlayerName = 'Brian Gionta' )",
"index": 3258,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Brian Gionta', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayers refers to PlayerName; height refers to height_in_cm;\nIdentify the players with the same height as Brian Gionta. How tall are they?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftyear integer, -- example: [1999, 2001]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\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 player refers to PlayerName; most NHL points in draft year refers to MAX(P);\nName the player who has the most NHL points in draft year.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.P = ( SELECT MAX(P) FROM SeasonStatus )",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.P = ( SELECT MAX(P) FROM SeasonStatus )",
"index": 3259,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftyear integer, -- example: [1999, 2001]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\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 player refers to PlayerName; most NHL points in draft year refers to MAX(P);\nName the player who has the most NHL points in draft year.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Toronto Maple Leafs', 'Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrafted by the Toronto Maple Leafs refers to overallby = 'Toronto Maple Leafs'; played over 300 games in their first 7 years of the NHL career refers to sum_7yr_GP > 300;\nHow many players who were drafted by the Toronto Maple Leafs have played over 300 games in their first 7 years of the NHL career?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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(ELITEID) FROM PlayerInfo WHERE overallby = 'Toronto Maple Leafs' AND sum_7yr_GP > 300",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT COUNT(ELITEID) FROM PlayerInfo WHERE overallby = 'Toronto Maple Leafs' AND sum_7yr_GP > 300",
"index": 3260,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Toronto Maple Leafs', 'Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrafted by the Toronto Maple Leafs refers to overallby = 'Toronto Maple Leafs'; played over 300 games in their first 7 years of the NHL career refers to sum_7yr_GP > 300;\nHow many players who were drafted by the Toronto Maple Leafs have played over 300 games in their first 7 years of the NHL career?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthyear date, -- example: [1981, 1980]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2005-2006', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Yale Univ.', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow tall refers to height_in_cm; Yale University refers to TEAM = 'Yale Univ.'; 28 penalty minutes refers to PIM = '28'; 2005-2006 season refers to SEASON = '2005-2006';\nHow tall is the player from Yale University who picked up 28 penalty minutes in the 2005-2006 season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.height_in_cm FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T2.height = T3.height_id WHERE T1.SEASON = '2005-2006' AND T1.TEAM = 'Yale Univ.' AND T1.PIM = 28",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T3.height_in_cm FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T2.height = T3.height_id WHERE T1.SEASON = '2005-2006' AND T1.TEAM = 'Yale Univ.' AND T1.PIM = 28",
"index": 3261,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthyear date, -- example: [1981, 1980]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2005-2006', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Yale Univ.', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhow tall refers to height_in_cm; Yale University refers to TEAM = 'Yale Univ.'; 28 penalty minutes refers to PIM = '28'; 2005-2006 season refers to SEASON = '2005-2006';\nHow tall is the player from Yale University who picked up 28 penalty minutes in the 2005-2006 season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Ian Schultz', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2007-2008', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Calgary Hitmen ', 'Calgary Hitmen', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoals scored refers to G; Calgary Hitmen refers to TEAM = 'Calgary Hitmen'; percentage = MULTIPLY(DIVIDE(SUM(G WHERE PlayerName = 'Ian Schultz'), SUM(G)), 100); 2007-2008 season refers to SEASON = '2007-2008';\nAmong all goals scored by Calgary Hitmen in the 2007-2008 season, identify the percentage scored by Ian Schultz.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName = 'Ian Schultz' THEN T1.G ELSE 0 END) AS REAL) * 100 / SUM(T1.G) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2007-2008' AND T1.TEAM = 'Calgary Hitmen'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.PlayerName = 'Ian Schultz' THEN T1.G ELSE 0 END) AS REAL) * 100 / SUM(T1.G) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2007-2008' AND T1.TEAM = 'Calgary Hitmen'",
"index": 3262,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Ian Schultz', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2007-2008', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Calgary Hitmen ', 'Calgary Hitmen', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ngoals scored refers to G; Calgary Hitmen refers to TEAM = 'Calgary Hitmen'; percentage = MULTIPLY(DIVIDE(SUM(G WHERE PlayerName = 'Ian Schultz'), SUM(G)), 100); 2007-2008 season refers to SEASON = '2007-2008';\nAmong all goals scored by Calgary Hitmen in the 2007-2008 season, identify the percentage scored by Ian Schultz.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Yevgeni Muratov', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1999-2000', '1997-1998']\n TEAM text, -- example: ['Ak Bars Kazan', 'Ak Bars Kazan-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npenalty minutes refers to PIM; Ak Bars Kazan refers to TEAM = 'Ak Bars Kazan'; percentage = MULTIPLY(DIVIDE(SUM(PIM WHERE PlayerName = 'Yevgeni Muratov'), SUM(PIM)), 100.0); 1999-2000 season refers to SEASON = '1999-2000';\nAmong all penalty minutes picked up by Ak Bars Kazan in the 1999-2000 season, identify the percentage picked up by Yevgeni Muratov.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName = 'Yevgeni Muratov' THEN T1.PIM ELSE 0 END) AS REAL) * 100 / SUM(T1.PIM) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1999-2000' AND T1.TEAM = 'Ak Bars Kazan'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT CAST(SUM(CASE WHEN T2.PlayerName = 'Yevgeni Muratov' THEN T1.PIM ELSE 0 END) AS REAL) * 100 / SUM(T1.PIM) FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '1999-2000' AND T1.TEAM = 'Ak Bars Kazan'",
"index": 3263,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Yevgeni Muratov', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1999-2000', '1997-1998']\n TEAM text, -- example: ['Ak Bars Kazan', 'Ak Bars Kazan-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npenalty minutes refers to PIM; Ak Bars Kazan refers to TEAM = 'Ak Bars Kazan'; percentage = MULTIPLY(DIVIDE(SUM(PIM WHERE PlayerName = 'Yevgeni Muratov'), SUM(PIM)), 100.0); 1999-2000 season refers to SEASON = '1999-2000';\nAmong all penalty minutes picked up by Ak Bars Kazan in the 1999-2000 season, identify the percentage picked up by Yevgeni Muratov.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Tony Martensson', 'David Bornhammar', 'David Printz']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat is the weight in kg of Tony Martensson?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'Tony Martensson'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'Tony Martensson'",
"index": 3264,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Tony Martensson', 'David Bornhammar', 'David Printz']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhat is the weight in kg of Tony Martensson?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_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 players refers to PlayerName; weight 190 lbs refers to weight_in_lbs = 190;\nList out the name of players who weight 190 lbs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_lbs = 190",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T1.PlayerName FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T2.weight_in_lbs = 190",
"index": 3265,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_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 players refers to PlayerName; weight 190 lbs refers to weight_in_lbs = 190;\nList out the name of players who weight 190 lbs.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['Denmark', 'Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftround integer, -- example: [7, 3]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(SUM(weight_in_lbs > 154 and nation = 'Denmark'), COUNT(ELITEID)), 100); players refers to PlayerName; born in Denmark refers to nation = 'Denmark'; weight above 154 lbs refers to weight_in_lbs > 154;\nWhat is the percentage of players who were born in Denmark and weight above 154 lbs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.nation = 'Denmark' AND T2.weight_in_lbs > 154 THEN T1.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.nation = 'Denmark' AND T2.weight_in_lbs > 154 THEN T1.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id",
"index": 3266,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['Denmark', 'Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftround integer, -- example: [7, 3]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(SUM(weight_in_lbs > 154 and nation = 'Denmark'), COUNT(ELITEID)), 100); players refers to PlayerName; born in Denmark refers to nation = 'Denmark'; weight above 154 lbs refers to weight_in_lbs > 154;\nWhat is the percentage of players who were born in Denmark and weight above 154 lbs?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Andreas Jamtin', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhich team does Andreas Jamtin belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT DISTINCT T1.TEAM FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Andreas Jamtin'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT DISTINCT T1.TEAM FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Andreas Jamtin'",
"index": 3267,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Andreas Jamtin', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nWhich team does Andreas Jamtin belong to?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Niklas Eckerblom', 'David Bornhammar', 'David Printz']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftround integer, -- example: [7, 3]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nList out the seasons that Niklas Eckerblom played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.SEASON FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Niklas Eckerblom'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT DISTINCT T1.SEASON FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Niklas Eckerblom'",
"index": 3268,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Niklas Eckerblom', 'David Bornhammar', 'David Printz']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n draftround integer, -- example: [7, 3]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nFALSE;\nList out the seasons that Niklas Eckerblom played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Matthias Trattnig', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\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 game refers to GAMETYPE;\nMention the type of game that Matthias Trattnig played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.GAMETYPE FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Matthias Trattnig'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT DISTINCT T1.GAMETYPE FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Matthias Trattnig'",
"index": 3269,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Matthias Trattnig', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\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 game refers to GAMETYPE;\nMention the type of game that Matthias Trattnig played.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Per Mars', 'David Bornhammar', 'David Printz']\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest point in the draft year refers to MAX(P);\nWhat is the highest point highest point of Per Mars in the draft year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.P FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Per Mars' ORDER BY T1.P DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T1.P FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.PlayerName = 'Per Mars' ORDER BY T1.P DESC LIMIT 1",
"index": 3270,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Per Mars', 'David Bornhammar', 'David Printz']\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nhighest point in the draft year refers to MAX(P);\nWhat is the highest point highest point of Per Mars in the draft year?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'8\"', '5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_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 players refers to PlayerName; height of 5'8\" refers to height_in_inch = '5''8\"';\nList out the name of players who have a height of 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 T2.PlayerName FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_inch = '5''8\"'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_inch = '5''8\"'",
"index": 3271,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'8\"', '5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_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 players refers to PlayerName; height of 5'8\" refers to height_in_inch = '5''8\"';\nList out the name of players who have a height of 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 SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1982 refers to birthyear = 1982; height above 182cm refers to height_in_cm > 182 ;\nHow many players were born in 1982 and have a height above 182cm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_cm > 182 AND strftime('%Y', T2.birthdate) = '1982'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T1.height_in_cm > 182 AND strftime('%Y', T2.birthdate) = '1982'",
"index": 3272,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nborn in 1982 refers to birthyear = 1982; height above 182cm refers to height_in_cm > 182 ;\nHow many players were born in 1982 and have a height above 182cm?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Russia', 'Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(SUM(nation = 'Russia' WHERE height_in_cm < 200), COUNT(ELITEID)), 100); Russian refers to nation = 'Russia'; players refers to PlayerName; height of under 200 inch refers to height_in_cm < 200;\nWhat is the percentage of Russian players who have a height of under 200 inch?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.height_in_cm < 200 AND T2.nation = 'Russia' THEN T2.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT CAST(COUNT(CASE WHEN T1.height_in_cm < 200 AND T2.nation = 'Russia' THEN T2.ELITEID ELSE NULL END) AS REAL) * 100 / COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height",
"index": 3273,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Russia', 'Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\npercentage = MULTIPLY(DIVIDE(SUM(nation = 'Russia' WHERE height_in_cm < 200), COUNT(ELITEID)), 100); Russian refers to nation = 'Russia'; players refers to PlayerName; height of under 200 inch refers to height_in_cm < 200;\nWhat is the percentage of Russian players who have a height of under 200 inch?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommitted the highest rule violations or penalty minutes refers to MAX(PIM); 2000-2001 season refers to SEASON = '2000-2001'\nWho among the players in season 2000-2001 has committed the highest rule violations or penalty minutes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' ORDER BY T1.PIM DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' ORDER BY T1.PIM DESC LIMIT 1",
"index": 3274,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncommitted the highest rule violations or penalty minutes refers to MAX(PIM); 2000-2001 season refers to SEASON = '2000-2001'\nWho among the players in season 2000-2001 has committed the highest rule violations or penalty minutes?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Avangard Omsk', 'Avangard Omsk-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; team Avangard Omsk refers to TEAM = 'Avangard Omsk'; 2000-2001 season refers to SEASON = '2000-2001';\nList the names of all players in team Avangard Omsk in season 2000-2001.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.TEAM = 'Avangard Omsk'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.TEAM = 'Avangard Omsk'",
"index": 3275,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Avangard Omsk', 'Avangard Omsk-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; team Avangard Omsk refers to TEAM = 'Avangard Omsk'; 2000-2001 season refers to SEASON = '2000-2001';\nList the names of all players in team Avangard Omsk in season 2000-2001.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Arizona Coyotes', 'Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwho refers to PlayerName; drafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes'; committed the highest rule violations refers to MAX(PIM); in 2000 refers to draftyear = 2000;\nWho among the players drafted by Arizona Coyotes in 2000 has committed the highest rule violations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.overallby = 'Arizona Coyotes' AND T2.draftyear = 2000 ORDER BY T1.PIM DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.overallby = 'Arizona Coyotes' AND T2.draftyear = 2000 ORDER BY T1.PIM DESC LIMIT 1",
"index": 3276,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Arizona Coyotes', 'Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nwho refers to PlayerName; drafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes'; committed the highest rule violations refers to MAX(PIM); in 2000 refers to draftyear = 2000;\nWho among the players drafted by Arizona Coyotes in 2000 has committed the highest rule violations?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Arizona Coyotes', 'Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes'; height reaches 195 centimeters refers to height_in_cm = 195;\nHow many players were drafted by Arizona Coyotes whose height reaches 195 centimeters?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.overallby = 'Arizona Coyotes' AND T1.height_in_cm = 195",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT COUNT(T2.ELITEID) FROM height_info AS T1 INNER JOIN PlayerInfo AS T2 ON T1.height_id = T2.height WHERE T2.overallby = 'Arizona Coyotes' AND T1.height_in_cm = 195",
"index": 3277,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Arizona Coyotes', 'Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ndrafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes'; height reaches 195 centimeters refers to height_in_cm = 195;\nHow many players were drafted by Arizona Coyotes whose height reaches 195 centimeters?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Avangard Omsk', 'Avangard Omsk-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Playoffs', 'Regular Season']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; Avangard Omsk refers to TEAM = 'Avangard Omsk'; playoffs refers to GAMETYPE = 'Playoffs'; 2000-2001 season refers to SEASON = '2000-2001';\nList the names of all players from Avangard Omsk that have played for playoffs in season 2000-2001.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.TEAM = 'Avangard Omsk' AND T1.GAMETYPE = 'Playoffs'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.TEAM = 'Avangard Omsk' AND T1.GAMETYPE = 'Playoffs'",
"index": 3278,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Avangard Omsk', 'Avangard Omsk-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Playoffs', 'Regular Season']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; Avangard Omsk refers to TEAM = 'Avangard Omsk'; playoffs refers to GAMETYPE = 'Playoffs'; 2000-2001 season refers to SEASON = '2000-2001';\nList the names of all players from Avangard Omsk that have played for playoffs in season 2000-2001.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftround integer, -- example: [7, 3]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['International', 'QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost valuable player refers to MAX(P); 2000-2001 season refers to SEASON = '2000-2001'; International league refers to LEAGUE = 'International';\nWho is the most valuable player who played in the 2000-2001 season of the International league?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' ORDER BY T1.P DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT DISTINCT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' ORDER BY T1.P DESC LIMIT 1",
"index": 3279,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftround integer, -- example: [7, 3]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['International', 'QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmost valuable player refers to MAX(P); 2000-2001 season refers to SEASON = '2000-2001'; International league refers to LEAGUE = 'International';\nWho is the most valuable player who played in the 2000-2001 season of the International league?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Avangard Omsk', 'Avangard Omsk-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['International', 'QMJHL', 'WJC-20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; Avangard Omsk refers to TEAM = 'Avangard Omsk'; International league refers to LEAGUE = 'International'; no goals in draft year refers to G = 0; 2000-2001 season refers to SEASON = '2000-2001';\nList the names of all players from Avangard Omsk who played in the 2000-2001 season of the International league that have no goals in draft year.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' AND T1.TEAM = 'Czech Republic (all)' AND T1.G = 0",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.PlayerName FROM SeasonStatus AS T1 INNER JOIN PlayerInfo AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.SEASON = '2000-2001' AND T1.LEAGUE = 'International' AND T1.TEAM = 'Czech Republic (all)' AND T1.G = 0",
"index": 3280,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['2000-2001', '1997-1998', '1999-2000']\n TEAM text, -- example: ['Avangard Omsk', 'Avangard Omsk-2', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['International', 'QMJHL', 'WJC-20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nnames of the players refers to PlayerName; Avangard Omsk refers to TEAM = 'Avangard Omsk'; International league refers to LEAGUE = 'International'; no goals in draft year refers to G = 0; 2000-2001 season refers to SEASON = '2000-2001';\nList the names of all players from Avangard Omsk who played in the 2000-2001 season of the International league that have no goals in draft year.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Arizona Coyotes', 'Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheaviest player refers to MAX(weight_in_lb); drafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes';\nHow many teams did the heaviest player drafted by Arizona Coyotes have played for?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TEAM) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN weight_info AS T3 ON T1.weight = T3.weight_id WHERE T1.overallby = 'Arizona Coyotes' ORDER BY T3.weight_in_lbs DESC LIMIT 1",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT COUNT(T2.TEAM) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN weight_info AS T3 ON T1.weight = T3.weight_id WHERE T1.overallby = 'Arizona Coyotes' ORDER BY T3.weight_in_lbs DESC LIMIT 1",
"index": 3281,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Arizona Coyotes', 'Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nheaviest player refers to MAX(weight_in_lb); drafted by Arizona Coyotes refers to overallby = 'Arizona Coyotes';\nHow many teams did the heaviest player drafted by Arizona Coyotes have played for?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Per Mars', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1997-1998 season refers to SEASON = '1997-1998';\nHow many games did Per Mars play in the 1997-1998 season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.GP FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.SEASON = '1997-1998' AND T1.PlayerName = 'Pavel Patera'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.GP FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.SEASON = '1997-1998' AND T1.PlayerName = 'Pavel Patera'",
"index": 3282,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Per Mars', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1997-1998 season refers to SEASON = '1997-1998';\nHow many games did Per Mars play in the 1997-1998 season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Matthias Trattnig', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_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 heavy in kilograms refers to weight_in_kg;\nHow heavy is Matthias Trattnig in kilograms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'Pavel Patera'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.weight_in_kg FROM PlayerInfo AS T1 INNER JOIN weight_info AS T2 ON T1.weight = T2.weight_id WHERE T1.PlayerName = 'Pavel Patera'",
"index": 3283,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Matthias Trattnig', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n shoots text, -- example: ['L', 'R']\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_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 heavy in kilograms refers to weight_in_kg;\nHow heavy is Matthias Trattnig in kilograms?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Niklas Eckerblom', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1997-1998 season refers to SEASON = '1997-1998';\nWhat team did Niklas Eckerblom play in the 1997-1998 season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TEAM FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.SEASON = '1997-1998' AND T1.PlayerName = 'Niko Kapanen'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T2.TEAM FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.SEASON = '1997-1998' AND T1.PlayerName = 'Niko Kapanen'",
"index": 3284,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Niklas Eckerblom', 'David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_kg integer, -- example: [70, 72]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Rimouski Oceanic', 'Canada U20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\n1997-1998 season refers to SEASON = '1997-1998';\nWhat team did Niklas Eckerblom play in the 1997-1998 season?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Sweden', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSwedish refers to nation = 'Sweden'; team with the most Swedish refers to MAX(TEAM WHERE nation = 'Sweden');\nWhich team has the most Swedish?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TEAM FROM ( SELECT T2.TEAM, COUNT(DISTINCT T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.nation = 'Sweden' GROUP BY T2.TEAM ORDER BY COUNT(DISTINCT T1.ELITEID) DESC LIMIT 1 ) AS T",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T.TEAM FROM ( SELECT T2.TEAM, COUNT(DISTINCT T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.nation = 'Sweden' GROUP BY T2.TEAM ORDER BY COUNT(DISTINCT T1.ELITEID) DESC LIMIT 1 ) AS T",
"index": 3285,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n birthmonth integer, -- example: [6, 7]\n birthday integer, -- example: [15, 24]\n birthplace text, -- example: ['Lidingo, SWE', 'Stockholm, SWE']\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftyear integer, -- example: [1999, 2001]\n draftround integer, -- example: [7, 3]\n overall integer, -- example: [192, 225]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_GP integer, -- sum 7-year game plays, example: [0, 13]\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n weight_in_lbs integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Sweden', 'Rimouski Oceanic', 'Canada U20']\n LEAGUE text, -- example: ['QMJHL', 'WJC-20']\n GAMETYPE text, -- example: ['Regular Season', 'Playoffs']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PIM integer, -- Penalty Minutes, example: [117, 46]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSwedish refers to nation = 'Sweden'; team with the most Swedish refers to MAX(TEAM WHERE nation = 'Sweden');\nWhich team has the most Swedish?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n GAMETYPE text, -- example: ['Playoffs', 'Regular Season']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Per Mars', 'David Bornhammar', 'David Printz']\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayoffs refers to GAMETYPE = 'Playoffs';\nHow many playoffs did Per Mars participate in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM(T2.GP) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.PlayerName = 'Per Mars' AND T2.GAMETYPE = 'Playoffs'",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT SUM(T2.GP) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T1.PlayerName = 'Per Mars' AND T2.GAMETYPE = 'Playoffs'",
"index": 3286,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n GAMETYPE text, -- example: ['Playoffs', 'Regular Season']\n GP integer, -- Game Plays, example: [58, 18]\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n PLUSMINUS integer, -- Plus Minutes, example: [27, 4]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['Per Mars', 'David Bornhammar', 'David Printz']\n birthday integer, -- example: [15, 24]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n CSS_rank integer, -- Central Scouting Service ranking, example: [192, 176]\n GP_greater_than_0 text, -- game play greater than 0, example: ['no', 'yes']\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nplayoffs refers to GAMETYPE = 'Playoffs';\nHow many playoffs did Per Mars participate in?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Plymouth Whalers', 'Rimouski Oceanic', 'Canada U20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthmonth integer, -- example: [6, 7]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry and nation are synonyms; country where most players come from refers to MAX(COUNT(nation WHERE TEAM = 'Plymouth Whalers')); players refers to PlayerName; team Plymouth Whalers refers to TEAM = 'Plymouth Whalers';\nWhich country do most players of team Plymouth Whalers come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T.nation FROM ( SELECT T1.nation, COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.TEAM = 'Plymouth Whalers' GROUP BY T1.nation ORDER BY COUNT(T1.ELITEID) DESC LIMIT 1 ) AS T",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T.nation FROM ( SELECT T1.nation, COUNT(T1.ELITEID) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID WHERE T2.TEAM = 'Plymouth Whalers' GROUP BY T1.nation ORDER BY COUNT(T1.ELITEID) DESC LIMIT 1 ) AS T",
"index": 3287,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['Plymouth Whalers', 'Rimouski Oceanic', 'Canada U20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_inch text, -- example: ['5\\'5\"', '5\\'7\"']\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthmonth integer, -- example: [6, 7]\n nation text, -- example: ['Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n position_info text, -- position information, example: ['D', 'C']\n shoots text, -- example: ['L', 'R']\n draftround integer, -- example: [7, 3]\n overallby text, -- example: ['Washington Capitals', 'Philadelphia Flyers']\n sum_7yr_TOI integer, -- sum 7-year time on ice, example: [0, 84]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ncountry and nation are synonyms; country where most players come from refers to MAX(COUNT(nation WHERE TEAM = 'Plymouth Whalers')); players refers to PlayerName; team Plymouth Whalers refers to TEAM = 'Plymouth Whalers';\nWhich country do most players of team Plymouth Whalers come from?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['USA U20 ', 'USA U20', 'USA', 'Rimouski Oceanic', 'Canada U20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['USA', 'Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntallest refers to MAX(height_in_cm); \nplayer refers to PlayerName; team USA U20 refers to TEAM = 'USA U20';\nWho is the tallest player in team USA U20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.PlayerName FROM ( SELECT T1.PlayerName, T3.height_in_cm FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' ORDER BY T3.height_in_cm DESC ) AS T WHERE T.height_in_cm = ( SELECT MAX(T3.height_in_cm) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' )",
"style": "rule"
} | {
"db_id": "ice_hockey_draft.sqlite",
"gt_sql": "SELECT T.PlayerName FROM ( SELECT T1.PlayerName, T3.height_in_cm FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' ORDER BY T3.height_in_cm DESC ) AS T WHERE T.height_in_cm = ( SELECT MAX(T3.height_in_cm) FROM PlayerInfo AS T1 INNER JOIN SeasonStatus AS T2 ON T1.ELITEID = T2.ELITEID INNER JOIN height_info AS T3 ON T1.height = T3.height_id WHERE T2.TEAM = 'USA U20' )",
"index": 3288,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SeasonStatus (\n ELITEID integer, -- example: [3667, 3668]\n SEASON text, -- example: ['1997-1998', '1999-2000']\n TEAM text, -- example: ['USA U20 ', 'USA U20', 'USA', 'Rimouski Oceanic', 'Canada U20']\n G integer, -- example: [44, 15]\n A integer, -- example: [71, 26]\n P integer, -- example: [115, 41]\n CONSTRAINT fk_seasonstatus_eliteid FOREIGN KEY (ELITEID) REFERENCES PlayerInfo (ELITEID)\n);\n\nCREATE TABLE weight_info (\n weight_id integer, -- example: [154, 159]\n PRIMARY KEY (weight_id)\n);\n\nCREATE TABLE height_info (\n height_id integer, -- example: [65, 67]\n height_in_cm integer, -- example: [165, 170]\n PRIMARY KEY (height_id)\n);\n\nCREATE TABLE PlayerInfo (\n ELITEID integer, -- example: [9, 18]\n PlayerName text, -- example: ['David Bornhammar', 'David Printz']\n birthdate text, -- example: ['1981-06-15', '1980-07-24']\n birthyear date, -- example: [1981, 1980]\n nation text, -- example: ['USA', 'Sweden', 'Austria']\n height integer, -- example: [73, 76]\n weight integer, -- example: [198, 220]\n PRIMARY KEY (ELITEID),\n CONSTRAINT fk_playerinfo_height FOREIGN KEY (height) REFERENCES height_info (height_id),\n CONSTRAINT fk_playerinfo_weight FOREIGN KEY (weight) REFERENCES weight_info (weight_id)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\ntallest refers to MAX(height_in_cm); \nplayer refers to PlayerName; team USA U20 refers to TEAM = 'USA U20';\nWho is the tallest player in team USA U20?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['CA', 'FR']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['CA', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['CA-1098', 'AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['CA', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n MaritalStatus text, -- example: ['S', 'M']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['CA', 'US']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAverage cost = AVG(StandardCost)\nWhat is the average standard cost of product number CA-1098?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT AVG(T2.StandardCost) FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductNumber = 'CA-1098'",
"index": 3289,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ProductAssemblyID integer, -- example: [3, 316]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n Bonus real, -- example: [0.0, 4100.0]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n CatalogDescription text, -- example: ['<?xml-stylesheet href=\"ProductDescriptio']\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n PreferredVendorStatus integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['CA', 'FR']\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n Resume text, -- example: ['<ns:Resume xmlns:ns=\"http://schemas.micr']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n Status integer, -- example: [5]\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n CreditCardID integer, -- example: [16281, 5618]\n CurrencyRateID integer, -- example: [4, 8]\n Freight real, -- example: [616.0984, 38.8276]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n MiddleName text, -- example: ['J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['CA', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['CA-1098', 'AR-5381', 'BA-8327']\n Color text, -- example: ['Black', 'Silver']\n SafetyStockLevel integer, -- example: [1000, 800]\n StandardCost real, -- example: [0.0, 98.77]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductSubcategoryID integer, -- example: [14, 31]\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['CA', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n MaritalStatus text, -- example: ['S', 'M']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n AverageLeadTime integer, -- example: [17, 19]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['CA', 'US']\n `Group` text, -- example: ['North America', 'Europe']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nAverage cost = AVG(StandardCost)\nWhat is the average standard cost of product number CA-1098?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n MaritalStatus text, -- example: ['S', 'M']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n ProductLine text, -- example: ['R', 'S']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(product.StandardCost, CostHistory.StandardCost)>80\nList the products whereby the standard cost is $80 more than previous standard cost in history.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost - T2.StandardCost > 80 GROUP BY T1.Name",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name FROM Product AS T1 INNER JOIN ProductCostHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.StandardCost - T2.StandardCost > 80 GROUP BY T1.Name",
"index": 3290,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n MaritalStatus text, -- example: ['S', 'M']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n ModifiedDate datetime, -- example: ['2011-12-23 00:00:00.0', '2011-04-25 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n SalesOrderNumber text, -- example: ['SO43659', 'SO43660']\n CustomerID integer, -- example: [29825, 29672]\n BillToAddressID integer, -- example: [985, 921]\n ShipToAddressID integer, -- example: [985, 921]\n ShipMethodID integer, -- example: [5, 1]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionType text, -- example: ['W', 'S']\n ActualCost real, -- example: [0.0, 6.0]\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['58', 'M']\n ProductLine text, -- example: ['R', 'S']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhoto blob, -- example: ['0x474946383961F0009500F70000D3D3FEE2E3FE', '0x474946383961F0009500F7000086878AECEDFE']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Title text, -- example: ['Ms.', 'Mr.']\n FirstName text, -- example: ['Ken', 'Terri']\n LastName text, -- example: ['Sánchez', 'Duffy']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n Demographics text, -- example: ['<StoreSurvey xmlns=\"http://schemas.micro']\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n TransactionType text, -- example: ['P', 'S']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n LineTotal real, -- example: [2025.0, 6075.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n EndDate datetime, -- example: ['2010-05-03 00:00:00.0', '2010-05-17 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n FileName text, -- example: ['Documents', 'Overview']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSUBTRACT(product.StandardCost, CostHistory.StandardCost)>80\nList the products whereby the standard cost is $80 more than previous standard cost in history.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n TerritoryID integer, -- example: [5, 6]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n MaritalStatus text, -- example: ['S', 'M']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProduct with more than 5 quantity refers to Quantity>5\nList the product name with more than 5 quantity in the shopping cart.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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 Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 5",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 5",
"index": 3291,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n EndDate date, -- example: ['2010-05-30', '2009-07-14']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n ModifiedDate datetime, -- example: ['2011-04-23 00:00:00.0', '2011-05-07 00:00:00.0']\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n DaysToManufacture integer, -- example: [0, 1]\n Style text, -- example: ['U', 'W']\n ProductModelID integer, -- example: [6, 33]\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OrderDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n Status integer, -- example: [5]\n TerritoryID integer, -- example: [5, 6]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordSalt text, -- example: ['bE3XiWw=', 'EjJaC3U=']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationLevel integer, -- example: [1, 2]\n MaritalStatus text, -- example: ['S', 'M']\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Title text, -- example: ['Documents', 'Overview']\n Owner integer, -- example: [217, 219]\n FileName text, -- example: ['Documents', 'Overview']\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n LastName text, -- example: ['Sánchez', 'Duffy']\n EmailPromotion integer, -- example: [0, 1]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProduct with more than 5 quantity refers to Quantity>5\nList the product name with more than 5 quantity in the shopping cart.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CreditCardID integer, -- example: [16281, 5618]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['M', '58']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductLine text, -- example: ['M', 'R', 'S']\n Class text, -- example: ['M', 'L']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['M', 'S']\n SalariedFlag integer, -- example: [1, 0]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['M', 'J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['M', 'A', 'B']\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe Mountain line refers to the product line, therefore ProductLine = 'M'\nHow many transactions are there for product under the Mountain line?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.TransactionID) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'M'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT COUNT(T2.TransactionID) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductLine = 'M'",
"index": 3292,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n Status integer, -- example: [5]\n OnlineOrderFlag integer, -- example: [0, 1]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n CreditCardID integer, -- example: [16281, 5618]\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n Status integer, -- example: [2, 1]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n rowguid text, -- example: ['26A266F1-1D23-40E2-AF48-6AB8D954FE37', '27CF33AF-C338-4842-966C-75CA11AAA6A3']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PostalCode text, -- example: ['K4B 1S2', 'V5A 4X1']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n ModifiedDate datetime, -- example: ['2007-12-04 00:00:00.0', '2008-11-30 00:00:00.0']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n rowguid text, -- example: ['00FB7309-96CC-49E2-8363-0A1BA72486F2', '05FC7E1F-2DEA-414E-9ECD-09D150516FB5']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n ProductNumber text, -- example: ['AR-5381', 'BA-8327']\n FinishedGoodsFlag integer, -- example: [0, 1]\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n ListPrice real, -- example: [0.0, 133.34]\n Size text, -- example: ['M', '58']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductLine text, -- example: ['M', 'R', 'S']\n Class text, -- example: ['M', 'L']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2014-02-08 10:01:36.0', '2014-02-08 10:03:55.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['M', 'BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n EmailAddress text, -- example: ['ken0@adventure-works.com', 'terri0@adventure-works.com']\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipRate real, -- example: [0.99, 1.99]\n rowguid text, -- example: ['107E8356-E7A8-463D-B60C-079FFF467F3F', '22F4E461-28CF-4ACE-A980-F686CF112EC8']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n DateCreated datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['M', 'S']\n SalariedFlag integer, -- example: [1, 0]\n rowguid text, -- example: ['00027A8C-C2F8-4A31-ABA8-8A203638B8F1', '01B119A2-2AF3-4775-818E-B421FECB07A7']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n FirstName text, -- example: ['Ken', 'Terri']\n MiddleName text, -- example: ['M', 'J', 'Lee']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n Demographics text, -- example: ['<IndividualSurvey xmlns=\"http://schemas.']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n ActiveFlag integer, -- example: [1, 0]\n PurchasingWebServiceURL text, -- example: ['www.litwareinc.com/', 'www.treyresearch.net/']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ActualCost real, -- example: [50.0, 45.0]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n AccountNumber text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n StockedQty real, -- example: [3.0, 550.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['M', 'A', 'B']\n Bin integer, -- example: [1, 5]\n ModifiedDate datetime, -- example: ['2014-08-08 00:00:00.0', '2008-03-31 00:00:00.0']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nThe Mountain line refers to the product line, therefore ProductLine = 'M'\nHow many transactions are there for product under the Mountain line?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost; Quantity)), where ShoppingCartID = '20621'\nHow much would be the total sales profit for shopping cart ID 20621 ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 20621",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN ShoppingCartItem AS T2 ON T1.ProductID = T2.ProductID WHERE T2.ShoppingCartID = 20621",
"index": 3293,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n MakeFlag integer, -- example: [0, 1]\n FinishedGoodsFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbNailPhoto blob, -- example: ['0x47494638396150003100F70000E3E3FCA6ACB3', '0x47494638396150003100F70000E3E3FCEBECF3']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n OrganizationLevel integer, -- example: [1, 2]\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n MaritalStatus text, -- example: ['S', 'M']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n VacationHours integer, -- example: [99, 1]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Shelf text, -- example: ['A', 'B']\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ActualResourceHrs real, -- Actual Resource Hours, example: [4.1, 3.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n DiscountPct real, -- Discount precentage, example: [0.0]\n Category text, -- example: ['No Discount', 'Reseller']\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n ReceivedQty real, -- example: [3.0, 550.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n LastReceiptDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PasswordHash text, -- example: ['pbFwXWE99vobT6g+vPWFy93NtUU/orrIWafF01hc', 'bawRVNrZQYQ05qF05Gz6VLilnviZmrqBReTTAGAu']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n Rate real, -- example: [125.5, 63.4615]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n NameStyle integer, -- example: [0]\n Title text, -- example: ['Ms.', 'Mr.']\n Suffix text, -- example: ['III', 'Jr.']\n EmailPromotion integer, -- example: [0, 1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n CostRate real, -- example: [0.0, 22.5]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n EndDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n ReferenceOrderLineID integer, -- example: [0, 1]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n rowguid text, -- example: ['0022434C-E325-47B0-92A0-7302FFA5046F', '00A811E1-D1A5-47B0-8D94-1C6FBAC4C743']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n ModifiedDate datetime, -- example: ['2014-02-08 10:17:21.0', '2008-04-30 00:00:00.0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PurchaseOrderNumber text, -- example: ['PO522145787', 'PO18850127500']\n CustomerID integer, -- example: [29825, 29672]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n ModifiedDate datetime, -- example: ['2011-06-07 00:00:00.0', '2011-06-08 00:00:00.0']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n FileName text, -- example: ['Documents', 'Overview']\n Revision text, -- example: ['0', '4']\n ModifiedDate datetime, -- example: ['2017-12-13 13:58:03.0', '2013-05-30 00:00:00.0']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2014-02-08 10:32:17.0']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nSales profit = MULTIPLY(SUBTRACT(ListPrice, StandardCost; Quantity)), where ShoppingCartID = '20621'\nHow much would be the total sales profit for shopping cart ID 20621 ?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['S', 'W']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['H', 'L', 'M']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Quality', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHigh quality refers to the product's quality class, therefore Class = 'H'\nList all product names that are high in quality. Please also state its selling 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 Name, ListPrice FROM Product WHERE Class = 'H'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT Name, ListPrice FROM Product WHERE Class = 'H'",
"index": 3294,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n ModifiedDate datetime, -- example: ['2008-03-31 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n SalariedFlag integer, -- example: [1, 0]\n VacationHours integer, -- example: [99, 1]\n SickLeaveHours integer, -- example: [69, 20]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n CreditRating integer, -- example: [1, 2]\n ActiveFlag integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n TransactionType text, -- example: ['S', 'W']\n ActualCost real, -- example: [0.0, 6.0]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n CountryRegionCode text, -- example: ['FR', 'CA']\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n SalesLastYear real, -- example: [3298694.4938, 3607148.9371]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n DueDate datetime, -- example: ['2011-04-30 00:00:00.0', '2011-05-14 00:00:00.0']\n ProductID integer, -- example: [1, 359]\n LineTotal real, -- example: [201.0, 135.0]\n RejectedQty real, -- example: [0.0, 1.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n OnlineOrderFlag integer, -- example: [0, 1]\n ShipMethodID integer, -- example: [5, 1]\n CreditCardID integer, -- example: [16281, 5618]\n TaxAmt real, -- Tax Amount, example: [1971.5149, 124.2483]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine2 text, -- example: ['Space 55', 'Unit B-105']\n City text, -- example: ['Ottawa', 'Burnaby']\n StateProvinceID integer, -- example: [57, 7]\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n rowguid text, -- example: ['00013363-E32F-4615-9439-AFF156D480AE', '0001CCDA-AD2B-4BBE-8047-CAC51EFDBB53']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n ModifiedDate datetime, -- example: ['2017-12-13 13:20:24.0', '2017-12-13 13:20:25.0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n Freight real, -- example: [5.026, 6.8025]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n EmailAddress text, -- example: ['john@fourthcoffee.com', 'david@graphicdesigninstitute.com']\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderLineID integer, -- example: [1, 2]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n ScrapReasonID integer, -- example: [7, 11]\n ModifiedDate datetime, -- example: ['2011-06-13 00:00:00.0', '2011-06-19 00:00:00.0']\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:07.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n LastReceiptCost real, -- example: [50.2635, 41.916]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n PersonType text, -- example: ['EM', 'SP']\n Suffix text, -- example: ['III', 'Jr.']\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n Revision text, -- example: ['0', '4']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n SizeUnitMeasureCode text, -- example: ['CM']\n DaysToManufacture integer, -- example: [0, 1]\n Class text, -- example: ['H', 'L', 'M']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n CommissionPct real, -- Commission percentage, example: [0.0, 0.012]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardType text, -- example: ['SuperiorCard', 'Distinguish']\n ExpMonth integer, -- Expiration Month, example: [11, 8]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ComponentID integer, -- example: [749, 750]\n UnitMeasureCode text, -- example: ['EA', 'IN']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n rowguid text, -- example: ['0000C99C-2B71-4885-B976-C1CCAE896EF2', '00010EA0-5D0F-4F0A-A3FB-8FE8A8210956']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n ModifiedDate datetime, -- example: ['2017-12-13 13:21:02.0', '2017-12-13 13:21:03.0']\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-01 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Quality', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nHigh quality refers to the product's quality class, therefore Class = 'H'\nList all product names that are high in quality. Please also state its selling 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 ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Review', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreviewer whose name begin with letter 'J' = ReviewerName LIKE 'J%'\nProvide details of review from reviewer whose name begin with letter 'J'. State the product ID, rating and comments.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT ProductID, Rating, Comments FROM ProductReview WHERE ReviewerName LIKE 'J%'",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT ProductID, Rating, Comments FROM ProductReview WHERE ReviewerName LIKE 'J%'",
"index": 3295,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n TotalDue real, -- example: [222.1492, 300.6721]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n Rating integer, -- example: [5, 4]\n Comments text, -- example: [\"I can't believe I'm singing the praises \", 'A little on the heavy side, but overall ']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n AverageRate real, -- example: [1.0, 1.5491]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n LargePhotoFileName text, -- example: ['racer02_black_f_large.gif', 'racer02_black_large.gif']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionType text, -- example: ['W', 'S']\n ModifiedDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Review', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n NationalIDNumber text, -- example: ['10708100', '109272464']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n BOMLevel integer, -- bill of materials level, example: [2, 1]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n StateProvinceID integer, -- example: [57, 7]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n AccountNumber text, -- example: ['10-4020-000676', '10-4020-000117']\n TerritoryID integer, -- example: [5, 6]\n `Comment` text,\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nreviewer whose name begin with letter 'J' = ReviewerName LIKE 'J%'\nProvide details of review from reviewer whose name begin with letter 'J'. State the product ID, rating and comments.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Review', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n ProductLine text, -- example: ['R', 'S']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipMethodID integer, -- example: [5, 1]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProduct with the lowest rating refers to the rating\ngiven by the\nreviewer where Rating = 1\nState the product name, product line, rating and the selling price of product with the lowest rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT T1.Name, T1.ProductLine, T2.Rating, T1.ListPrice FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating ASC LIMIT 1",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name, T1.ProductLine, T2.Rating, T1.ListPrice FROM Product AS T1 INNER JOIN ProductReview AS T2 ON T1.ProductID = T2.ProductID ORDER BY T2.Rating ASC LIMIT 1",
"index": 3296,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n UnitPrice real, -- example: [50.0, 45.0]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Review', 'Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n GroupName text, -- example: ['Research and Development', 'Sales and Marketing']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipRate real, -- example: [0.99, 1.99]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n StartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-04 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n MakeFlag integer, -- example: [0, 1]\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n ProductLine text, -- example: ['R', 'S']\n DiscontinuedDate datetime,\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesYTD real, -- sales year to date, example: [559697.5639, 3763178.1787]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n ShipMethodID integer, -- example: [5, 1]\n TotalDue real, -- example: [23153.2339, 1457.3288]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n Rating integer, -- example: [5, 4]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ThumbnailPhotoFileName text, -- example: ['racer02_black_f_small.gif', 'racer02_black_small.gif']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n PlannedCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n Owner integer, -- example: [217, 219]\n ChangeNumber integer, -- example: [0, 28]\n Document blob, -- example: ['0xD0CF11E0A1B11AE10000000000000000000000']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Title text, -- example: ['Ms.', 'Mr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProduct with the lowest rating refers to the rating\ngiven by the\nreviewer where Rating = 1\nState the product name, product line, rating and the selling price of product with the lowest rating.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPurchase order with order quantity of 5000 or more refers to OrderQty> = 5000\nList all product names and its product line for all purchase order with order quantity of 5000 or more.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT T1.Name, T1.ProductLine FROM Product AS T1 INNER JOIN PurchaseOrderDetail AS T2 ON T1.ProductID = T2.ProductID WHERE T2.OrderQty > 4999",
"index": 3297,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n BusinessEntityID integer, -- example: [274, 212]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2014-09-12 11:15:06.0', '2011-08-01 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n TerritoryID integer, -- example: [6, 1]\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ScheduledEndDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PlannedCost real, -- example: [92.25, 87.5]\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n rowguid text, -- example: ['05C4FFDB-4F84-4CDF-ABE5-FDF3216EA74E', '06DF529D-EB11-446F-9570-9EE97B8EA1BF']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n Description text, -- example: ['Chromoly steel.', 'Aluminum alloy cups; large diameter spin']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n DiscountPct real, -- Discount precentage, example: [0.0]\n StartDate datetime, -- example: ['2011-05-01 00:00:00.0', '2011-05-31 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n StartTime text, -- example: ['07:00:00', '15:00:00']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n AddressLine1 text, -- example: [\"#500-75 O'Connor Street\", '#9900 2700 Production Way']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n StockedQty integer, -- Stocked Quantity, example: [8, 15]\n ScrappedQty integer, -- Scrapped Quantity, example: [0, 1]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TaxAmt real, -- Tax Amount, example: [16.0832, 21.7681]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n Color text, -- example: ['Black', 'Silver']\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n Suffix text, -- example: ['III', 'Jr.']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nPurchase order with order quantity of 5000 or more refers to OrderQty> = 5000\nList all product names and its product line for all purchase order with order quantity of 5000 or more.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmiinimum order quantity refers to MinOrderQty = 100\nList all products with minimum order quantity of 100 and order them by product name in descending order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\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.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT DISTINCT T1.Name FROM Product AS T1 INNER JOIN ProductVendor AS T2 ON T1.ProductID = T2.ProductID WHERE T2.MinOrderQty = 100 ORDER BY T1.Name DESC",
"index": 3298,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n MinOrderQty integer, -- Min Order Quantity, example: [1, 100]\n MaxOrderQty integer, -- Max Order Quantity, example: [5, 1000]\n OnOrderQty integer, -- On Order Quantity, example: [3, 300]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n CarrierTrackingNumber text, -- example: ['4911-403C-98', '6431-4D57-83']\n OrderQty integer, -- example: [1, 3]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPrice real, -- example: [2025.0, 2040.0]\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n rowguid text, -- example: ['8A1901E4-671B-431A-871C-EADB2942E9EE', 'B5FF9EFD-72A2-4F87-830B-F338FDD4D162']\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewerName text, -- example: ['John Smith', 'David']\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n rowguid text, -- example: ['00FFDFAC-0207-4DF0-8051-7D3C884816F3', '016CBBE9-D51B-4A50-94CD-5FF2DA577C5B']\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualEndDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n ActualCost real, -- example: [92.25, 87.5]\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n rowguid text, -- example: ['0020931C-087C-42F8-B441-EBE3D3B5F51E', '00365938-3422-494E-B92E-C00AFD691469']\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n Name text, -- example: ['Bottle', 'Boxes']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n SalesQuota real, -- example: [28000.0, 7000.0]\n rowguid text, -- example: ['00F2F9F8-5158-4436-B134-7E0C462289E5', '0103899F-618C-4478-90BB-815B20856F35']\n ModifiedDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-07-17 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n Name text, -- example: ['CARGO TRANSPORT 5', 'OVERNIGHT J-FAST']\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n `Group` text, -- example: ['North America', 'Europe']\n SalesYTD real, -- Sales Year to Date, example: [7887186.7882, 2402176.8476]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n ChangeNumber integer, -- example: [0, 28]\n Status integer, -- example: [2, 1]\n DocumentSummary text, -- example: ['It is important that you maintain your b', 'Guidelines and recommendations for lubri']\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n Name text, -- example: ['Day', 'Evening']\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n Name text, -- example: ['AWC Logo Cap', 'Adjustable Race']\n SafetyStockLevel integer, -- example: [1000, 800]\n ReorderPoint integer, -- example: [750, 600]\n StandardCost real, -- example: [0.0, 98.77]\n SizeUnitMeasureCode text, -- example: ['CM']\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n Weight real, -- example: [435.0, 450.0]\n DaysToManufacture integer, -- example: [0, 1]\n ProductLine text, -- example: ['R', 'S']\n Class text, -- example: ['L', 'M']\n ProductModelID integer, -- example: [6, 33]\n SellEndDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n ModifiedDate datetime,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n ReferenceOrderID integer, -- example: [1, 2]\n ReferenceOrderLineID integer, -- example: [1, 2]\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0', '2012-10-19 09:56:38.0']\n PRIMARY KEY (ProductPhotoID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n RevisionNumber integer, -- example: [8, 9]\n OnlineOrderFlag integer, -- example: [0, 1]\n BillToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n `Comment` text,\n rowguid text, -- example: ['0000DE87-AB3F-4920-AC46-C404834241A0', '00032DF7-5D34-4ECC-9BC2-353D3C918E93']\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesQuota real, -- example: [300000.0, 250000.0]\n Bonus real, -- example: [0.0, 4100.0]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n rowguid text, -- example: ['1DD1F689-DF74-4149-8600-59555EEF154B', '1E0A7274-3064-4F58-88EE-4C6586C87169']\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n OrganizationNode text, -- example: ['/1/', '/1/1/']\n JobTitle text, -- example: ['Chief Executive Officer', 'Vice President of Engineering']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n Name text, -- example: ['Canadian GST + Alberta Provincial Tax', 'Canadian GST + Ontario Provincial Tax']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n AccountNumber text, -- example: ['ADATUM0001', 'ADVANCED0001']\n Name text, -- example: ['Australia Bike Retailer', 'Allenson Cycles']\n PreferredVendorStatus integer, -- example: [1, 0]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n PerAssemblyQty real, -- per assembly quantity, example: [1.0, 3.0]\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n Name text, -- example: ['Arabic', 'Chinese']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n TotalDue real, -- example: [222.1492, 300.6721]\n ModifiedDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['AD', 'AE']\n Name text, -- example: ['Name', 'Afghanistan', 'Albania']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n ReferenceOrderID integer, -- example: [41590, 41591]\n TransactionDate datetime, -- example: ['2013-07-31 00:00:00.0', '2013-08-01 00:00:00.0']\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n ReasonType text, -- example: ['Other', 'Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n Name text, -- example: ['Archive', 'Billing']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n rowguid text, -- example: ['000191EF-7424-4A5F-AB19-0852B1F0B78D', '00034881-67FA-4CCA-908A-B1D42030979E']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n rowguid text, -- example: ['00021813-91EF-4A97-9682-0D2AC8C9EA97', '000392B5-933E-4BFF-945B-FF50AABBB7C0']\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n Name text, -- example: ['Ain', 'Aisne']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n ModifiedDate datetime, -- example: ['2012-11-22 00:00:00.0', '2012-11-23 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n MaxQty integer, -- Max Quality, example: [14, 24]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Name text, -- example: ['All-Purpose Bike Stand', 'Bike Wash']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n OrderQty integer, -- Order Quantity, example: [8, 15]\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n Name text, -- example: ['Next-Door Bike Store', 'Professional Sales and Service']\n SalesPersonID integer, -- example: [279, 276]\n rowguid text, -- example: ['004EA91C-FCD4-4973-87EF-9059C6E20BB5', '00A7E190-D705-4791-AAB5-AD218497DD06']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nmiinimum order quantity refers to MinOrderQty = 100\nList all products with minimum order quantity of 100 and order them by product name in descending order.\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"split": "train"
} |
nl2sql | [
{
"content": "You are a helpful assistant.",
"role": "system"
},
{
"content": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProfit = MULTIPLY(SUBTRACT(ListPrice, StandardCost) Quantity))\nWhat is the total profit all transactions with product ID 827?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\n-- Your SQL query\n```\n\nTake a deep breath and think step by step to find the correct SQL query.\n",
"role": "user"
}
] | nl2sql | {
"ground_truth": "SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827",
"style": "rule"
} | {
"db_id": "works_cycles.sqlite",
"gt_sql": "SELECT SUM((T1.ListPrice - T1.StandardCost) * T2.Quantity) FROM Product AS T1 INNER JOIN TransactionHistory AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID = 827",
"index": 3299,
"question": "Task Overview:\nYou are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.\n\nDatabase Engine:\nSQLite\n\nDatabase Schema:\nCREATE TABLE SalesTerritory (\n TerritoryID integer, -- example: [2, 10]\n Name text, -- example: ['Australia', 'Canada']\n CountryRegionCode text, -- example: ['US', 'CA']\n CostYTD real, -- Cost Year to Date, example: [0.0]\n CostLastYear real, -- example: [0.0]\n PRIMARY KEY (TerritoryID),\n CONSTRAINT fk_salesterritory_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode)\n);\n\nCREATE TABLE EmployeeDepartmentHistory (\n BusinessEntityID integer, -- example: [1, 2]\n DepartmentID integer, -- example: [16, 1]\n ShiftID integer, -- example: [1, 3]\n StartDate date, -- example: ['2009-01-14', '2008-01-31']\n ModifiedDate datetime, -- example: ['2009-01-13 00:00:00.0', '2008-01-30 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, DepartmentID, ShiftID, StartDate)\n);\n\nCREATE TABLE SpecialOffer (\n SpecialOfferID integer, -- example: [1, 15]\n Description text, -- example: ['No Discount', 'Volume Discount 11 to 14']\n Type text, -- example: ['No Discount', 'Volume Discount']\n Category text, -- example: ['No Discount', 'Reseller']\n EndDate datetime, -- example: ['2014-11-30 00:00:00.0', '2014-05-30 00:00:00.0']\n MinQty integer, -- Min Quality, example: [0, 11]\n rowguid text, -- example: ['0290C4F5-191F-4337-AB6B-0A2DDE03CBF9', '03E3594D-6EBB-46A6-B8EE-A9289C0C2E47']\n PRIMARY KEY (SpecialOfferID)\n);\n\nCREATE TABLE SalesPerson (\n BusinessEntityID integer, -- example: [287, 275]\n TerritoryID integer, -- example: [2, 4]\n SalesLastYear real, -- example: [0.0, 1750406.4785]\n ModifiedDate datetime, -- example: ['2010-12-28 00:00:00.0', '2011-05-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_salesperson_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_salesperson_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductModel (\n ProductModelID integer, -- example: [82, 57]\n Instructions text, -- example: ['<root xmlns=\"http://schemas.microsoft.co']\n rowguid text, -- example: ['00CE9171-8944-4D49-BA37-485C1D122F5C', '02200AA0-C369-4D77-A67C-75973EFDA81B']\n ModifiedDate datetime, -- example: ['2013-04-30 00:00:00.0', '2011-05-01 00:00:00.0']\n PRIMARY KEY (ProductModelID)\n);\n\nCREATE TABLE WorkOrderRouting (\n WorkOrderID integer, -- example: [13, 14]\n ProductID integer, -- example: [747, 748]\n OperationSequence integer, -- example: [1, 2]\n LocationID integer, -- example: [10, 20]\n ActualStartDate datetime, -- example: ['2011-06-03 00:00:00.0', '2011-06-09 00:00:00.0']\n ModifiedDate datetime, -- example: ['2011-06-19 00:00:00.0', '2011-06-15 00:00:00.0']\n PRIMARY KEY (WorkOrderID, ProductID, OperationSequence),\n CONSTRAINT fk_workorderrouting_workorderid FOREIGN KEY (WorkOrderID) REFERENCES WorkOrder (WorkOrderID),\n CONSTRAINT fk_workorderrouting_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE AddressType (\n AddressTypeID integer, -- example: [4, 2]\n rowguid text, -- example: ['24CB3088-4345-47C4-86C5-17B535133D1E', '41BC2FF6-F0FC-475F-8EB9-CEC0805AA0F2']\n PRIMARY KEY (AddressTypeID)\n);\n\nCREATE TABLE PersonCreditCard (\n BusinessEntityID integer, -- example: [293, 295]\n CreditCardID integer, -- example: [17038, 15369]\n PRIMARY KEY (BusinessEntityID, CreditCardID),\n CONSTRAINT fk_personcreditcard_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_personcreditcard_creditcardid FOREIGN KEY (CreditCardID) REFERENCES CreditCard (CreditCardID)\n);\n\nCREATE TABLE Employee (\n BusinessEntityID integer, -- example: [151, 170]\n LoginID text, -- example: ['adventure-works\\\\alan0', 'adventure-works\\\\alejandro0']\n HireDate date, -- example: ['2009-01-14', '2008-01-31']\n SalariedFlag integer, -- example: [1, 0]\n CurrentFlag integer, -- example: [1]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_employee_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE BusinessEntityContact (\n BusinessEntityID integer, -- example: [292, 294]\n PersonID integer, -- example: [291, 293]\n ContactTypeID integer, -- example: [11, 14]\n PRIMARY KEY (BusinessEntityID, PersonID, ContactTypeID),\n CONSTRAINT fk_businessentitycontact_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_businessentitycontact_contacttypeid FOREIGN KEY (ContactTypeID) REFERENCES ContactType (ContactTypeID)\n);\n\nCREATE TABLE StateProvince (\n StateProvinceID integer, -- example: [103, 101]\n IsOnlyStateProvinceFlag integer, -- example: [0, 1]\n Name text, -- example: ['Ain', 'Aisne']\n rowguid text, -- example: ['00723E00-C976-401D-A92B-E582DF3D6E01', '01CEC802-20CE-4F96-B475-2AD263CEA9D0']\n PRIMARY KEY (StateProvinceID)\n);\n\nCREATE TABLE WorkOrder (\n WorkOrderID integer, -- example: [1, 2]\n ProductID integer, -- example: [722, 725]\n DueDate datetime, -- example: ['2011-06-14 00:00:00.0', '2011-06-15 00:00:00.0']\n ScrapReasonID integer, -- example: [7, 11]\n PRIMARY KEY (WorkOrderID),\n CONSTRAINT fk_workorder_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_workorder_scrapreasonid FOREIGN KEY (ScrapReasonID) REFERENCES ScrapReason (ScrapReasonID)\n);\n\nCREATE TABLE Product (\n ProductID integer, -- example: [921, 351]\n FinishedGoodsFlag integer, -- example: [0, 1]\n Color text, -- example: ['Black', 'Silver']\n StandardCost real, -- example: [0.0, 98.77]\n ListPrice real, -- example: [0.0, 133.34]\n WeightUnitMeasureCode text, -- example: ['G', 'LB']\n ProductModelID integer, -- example: [6, 33]\n SellStartDate datetime, -- example: ['2008-04-30 00:00:00.0', '2011-05-31 00:00:00.0']\n PRIMARY KEY (ProductID)\n);\n\nCREATE TABLE SalesPersonQuotaHistory (\n BusinessEntityID integer, -- example: [274, 275]\n QuotaDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-08-31 00:00:00.0']\n PRIMARY KEY (BusinessEntityID, QuotaDate),\n CONSTRAINT fk_salespersonquotahistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE Location (\n LocationID integer, -- example: [30, 60]\n Name text, -- example: ['Debur and Polish', 'Final Assembly']\n CostRate real, -- example: [0.0, 22.5]\n Availability real, -- example: [0.0, 96.0]\n PRIMARY KEY (LocationID)\n);\n\nCREATE TABLE SalesOrderHeader (\n SalesOrderID integer, -- example: [71821, 44088]\n DueDate datetime, -- example: ['2011-06-12 00:00:00.0', '2011-06-13 00:00:00.0']\n OnlineOrderFlag integer, -- example: [0, 1]\n SalesPersonID integer, -- example: [279, 282]\n TerritoryID integer, -- example: [5, 6]\n ShipToAddressID integer, -- example: [985, 921]\n CurrencyRateID integer, -- example: [4, 8]\n SubTotal real, -- example: [20565.6206, 1294.2529]\n PRIMARY KEY (SalesOrderID)\n);\n\nCREATE TABLE ProductCostHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n StandardCost real, -- example: [12.0278, 13.8782]\n ModifiedDate datetime, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productcosthistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE SalesReason (\n SalesReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Price', 'On Promotion']\n PRIMARY KEY (SalesReasonID)\n);\n\nCREATE TABLE Department (\n DepartmentID integer, -- example: [12, 1]\n Name text, -- example: ['Document Control', 'Engineering']\n PRIMARY KEY (DepartmentID)\n);\n\nCREATE TABLE ShipMethod (\n ShipMethodID integer, -- example: [4, 3]\n ShipBase real, -- example: [3.95, 9.95]\n PRIMARY KEY (ShipMethodID)\n);\n\nCREATE TABLE ContactType (\n ContactTypeID integer, -- example: [1, 2]\n Name text, -- example: ['Accounting Manager', 'Assistant Sales Agent']\n PRIMARY KEY (ContactTypeID)\n);\n\nCREATE TABLE Store (\n BusinessEntityID integer, -- example: [630, 956]\n SalesPersonID integer, -- example: [279, 276]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_store_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_store_salespersonid FOREIGN KEY (SalesPersonID) REFERENCES SalesPerson (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegionCurrency (\n CountryRegionCode text, -- example: ['ID', 'AE', 'AR']\n CurrencyCode text, -- example: ['AED', 'ARS']\n PRIMARY KEY (CountryRegionCode, CurrencyCode),\n CONSTRAINT fk_countryregioncurrency_countryregioncode FOREIGN KEY (CountryRegionCode) REFERENCES CountryRegion (CountryRegionCode),\n CONSTRAINT fk_countryregioncurrency_currencycode FOREIGN KEY (CurrencyCode) REFERENCES Currency (CurrencyCode)\n);\n\nCREATE TABLE PurchaseOrderHeader (\n PurchaseOrderID integer, -- example: [1, 2]\n RevisionNumber integer, -- example: [4, 5]\n Status integer, -- example: [4, 1]\n EmployeeID integer, -- example: [258, 254]\n VendorID integer, -- example: [1580, 1496]\n ShipMethodID integer, -- example: [3, 5]\n OrderDate datetime, -- example: ['2011-04-16 00:00:00.0', '2011-04-30 00:00:00.0']\n ShipDate datetime, -- example: ['2011-04-25 00:00:00.0', '2011-05-09 00:00:00.0']\n SubTotal real, -- example: [201.04, 272.1015]\n PRIMARY KEY (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderheader_employeeid FOREIGN KEY (EmployeeID) REFERENCES Employee (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_vendorid FOREIGN KEY (VendorID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_purchaseorderheader_shipmethodid FOREIGN KEY (ShipMethodID) REFERENCES ShipMethod (ShipMethodID)\n);\n\nCREATE TABLE Shift (\n ShiftID integer, -- example: [1, 2]\n EndTime text, -- example: ['15:00:00', '23:00:00']\n PRIMARY KEY (ShiftID)\n);\n\nCREATE TABLE SpecialOfferProduct (\n SpecialOfferID integer, -- example: [1, 2]\n ProductID integer, -- example: [680, 706]\n PRIMARY KEY (SpecialOfferID, ProductID),\n CONSTRAINT fk_specialofferproduct_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOffer (SpecialOfferID),\n CONSTRAINT fk_specialofferproduct_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Address (\n AddressID integer, -- example: [18089, 23192]\n City text, -- example: ['Ottawa', 'Burnaby']\n rowguid text, -- example: ['00093F9C-0487-4723-B376-D90FF565AD6F', '000A2255-2D8E-4D99-B82F-7013B256EE31']\n PRIMARY KEY (AddressID)\n);\n\nCREATE TABLE Culture (\n CultureID text, -- example: ['ar', 'en']\n PRIMARY KEY (CultureID)\n);\n\nCREATE TABLE Customer (\n CustomerID integer,\n PersonID integer,\n StoreID integer,\n TerritoryID integer,\n rowguid text,\n PRIMARY KEY (CustomerID),\n CONSTRAINT fk_customer_personid FOREIGN KEY (PersonID) REFERENCES Person (BusinessEntityID),\n CONSTRAINT fk_customer_storeid FOREIGN KEY (StoreID) REFERENCES Store (BusinessEntityID),\n CONSTRAINT fk_customer_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE ProductInventory (\n ProductID integer, -- example: [1, 2]\n LocationID integer, -- example: [1, 6]\n Bin integer, -- example: [1, 5]\n Quantity integer, -- example: [408, 324]\n rowguid text, -- example: ['47A24246-6C43-48EB-968F-025738A8A410', 'D4544D7D-CAF5-46B3-AB22-5718DCC26B5E']\n PRIMARY KEY (ProductID, LocationID),\n CONSTRAINT fk_productinventory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productinventory_locationid FOREIGN KEY (LocationID) REFERENCES Location (LocationID)\n);\n\nCREATE TABLE ProductCategory (\n ProductCategoryID integer, -- example: [3, 4]\n Name text, -- example: ['Accessories', 'Bikes']\n rowguid text, -- example: ['10A7C342-CA82-48D4-8A38-46A2EB089B74', '2BE3BE36-D9A2-4EEE-B593-ED895D97C2A6']\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (ProductCategoryID)\n);\n\nCREATE TABLE ProductModelProductDescriptionCulture (\n ProductModelID integer, -- example: [1, 2]\n ProductDescriptionID integer, -- example: [1199, 1467]\n CultureID text, -- example: ['en', 'ar']\n PRIMARY KEY (ProductModelID, ProductDescriptionID, CultureID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productmodelid FOREIGN KEY (ProductModelID) REFERENCES ProductModel (ProductModelID),\n CONSTRAINT fk_productmodelproductdescriptionculture_productdescriptionid FOREIGN KEY (ProductDescriptionID) REFERENCES ProductDescription (ProductDescriptionID),\n CONSTRAINT fk_productmodelproductdescriptionculture_cultureid FOREIGN KEY (CultureID) REFERENCES Culture (CultureID)\n);\n\nCREATE TABLE SalesOrderDetail (\n SalesOrderID integer, -- example: [43659, 43660]\n SalesOrderDetailID integer, -- example: [54351, 90855]\n ProductID integer, -- example: [776, 777]\n SpecialOfferID integer, -- example: [1, 2]\n UnitPriceDiscount real, -- example: [0.0]\n LineTotal real, -- example: [2025.0, 6075.0]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderDetailID),\n CONSTRAINT fk_salesorderdetail_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderdetail_productid FOREIGN KEY (ProductID) REFERENCES SpecialOfferProduct (ProductID),\n CONSTRAINT fk_salesorderdetail_specialofferid FOREIGN KEY (SpecialOfferID) REFERENCES SpecialOfferProduct (SpecialOfferID)\n);\n\nCREATE TABLE UnitMeasure (\n UnitMeasureCode text, -- example: ['BOX', 'BTL']\n PRIMARY KEY (UnitMeasureCode)\n);\n\nCREATE TABLE Password (\n BusinessEntityID integer, -- example: [1, 2]\n rowguid text, -- example: ['329EACBE-C883-4F48-B8B6-17AA4627EFFF', 'A4C82398-7466-4FE6-B9EE-CEC34D116F68']\n ModifiedDate datetime, -- example: ['2009-01-07 00:00:00.0', '2008-01-24 00:00:00.0']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_password_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE CountryRegion (\n CountryRegionCode text, -- example: ['ID', 'AD', 'AE']\n Name text, -- example: ['Afghanistan', 'Albania']\n ModifiedDate datetime, -- example: ['ModifiedDate', '2008-04-30 00:00:00.0']\n PRIMARY KEY (CountryRegionCode)\n);\n\nCREATE TABLE Person (\n BusinessEntityID integer, -- example: [14617, 18779]\n AdditionalContactInfo text, -- example: ['<AdditionalContactInfo xmlns=\"http://sch']\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_person_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductDescription (\n ProductDescriptionID integer, -- example: [1954, 1370]\n PRIMARY KEY (ProductDescriptionID)\n);\n\nCREATE TABLE ProductVendor (\n ProductID integer, -- example: [1, 2]\n BusinessEntityID integer, -- example: [1580, 1688]\n UnitMeasureCode text, -- example: ['CS', 'CTN']\n ModifiedDate datetime, -- example: ['2011-08-29 00:00:00.0', '2011-08-25 00:00:00.0']\n PRIMARY KEY (ProductID, BusinessEntityID),\n CONSTRAINT fk_productvendor_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productvendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Vendor (BusinessEntityID),\n CONSTRAINT fk_productvendor_unitmeasurecode FOREIGN KEY (UnitMeasureCode) REFERENCES UnitMeasure (UnitMeasureCode)\n);\n\nCREATE TABLE SalesTerritoryHistory (\n BusinessEntityID integer, -- example: [275, 276]\n TerritoryID integer, -- example: [2, 3]\n StartDate datetime, -- example: ['2011-05-31 00:00:00.0', '2012-11-30 00:00:00.0']\n EndDate datetime, -- example: ['2012-11-29 00:00:00.0', '2012-09-29 00:00:00.0']\n rowguid text, -- example: ['009F7660-44A6-4ADF-BD4B-A5D1B79993F5', '132E4721-32DD-4A73-B556-1837F3A2B9AE']\n PRIMARY KEY (BusinessEntityID, TerritoryID, StartDate),\n CONSTRAINT fk_salesterritoryhistory_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES SalesPerson (BusinessEntityID),\n CONSTRAINT fk_salesterritoryhistory_territoryid FOREIGN KEY (TerritoryID) REFERENCES SalesTerritory (TerritoryID)\n);\n\nCREATE TABLE SalesOrderHeaderSalesReason (\n SalesOrderID integer, -- example: [43697, 43702]\n SalesReasonID integer, -- example: [5, 9]\n ModifiedDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n PRIMARY KEY (SalesOrderID, SalesReasonID),\n CONSTRAINT fk_salesorderheadersalesreason_salesorderid FOREIGN KEY (SalesOrderID) REFERENCES SalesOrderHeader (SalesOrderID),\n CONSTRAINT fk_salesorderheadersalesreason_salesreasonid FOREIGN KEY (SalesReasonID) REFERENCES SalesReason (SalesReasonID)\n);\n\nCREATE TABLE TransactionHistory (\n TransactionID integer, -- example: [100000, 100001]\n ProductID integer, -- example: [784, 794]\n Quantity integer, -- example: [2, 1]\n PRIMARY KEY (TransactionID),\n CONSTRAINT fk_transactionhistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BillOfMaterials (\n BillOfMaterialsID integer, -- example: [893, 271]\n ModifiedDate datetime, -- example: ['2010-02-18 00:00:00.0', '2010-04-20 00:00:00.0']\n PRIMARY KEY (BillOfMaterialsID)\n);\n\nCREATE TABLE BusinessEntityAddress (\n BusinessEntityID integer, -- example: [1, 2]\n AddressID integer, -- example: [249, 293]\n AddressTypeID integer, -- example: [2, 3]\n PRIMARY KEY (BusinessEntityID, AddressID, AddressTypeID),\n CONSTRAINT fk_businessentityaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID),\n CONSTRAINT fk_businessentityaddress_addressid FOREIGN KEY (AddressID) REFERENCES Address (AddressID),\n CONSTRAINT fk_businessentityaddress_addresstypeid FOREIGN KEY (AddressTypeID) REFERENCES AddressType (AddressTypeID)\n);\n\nCREATE TABLE ProductProductPhoto (\n ProductID integer, -- example: [1, 2]\n ProductPhotoID integer, -- example: [1, 160]\n `Primary` integer, -- example: [1]\n PRIMARY KEY (ProductID, ProductPhotoID),\n CONSTRAINT fk_productproductphoto_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productproductphoto_productphotoid FOREIGN KEY (ProductPhotoID) REFERENCES ProductPhoto (ProductPhotoID)\n);\n\nCREATE TABLE EmailAddress (\n BusinessEntityID integer, -- example: [1, 2]\n EmailAddressID integer, -- example: [1, 2]\n PRIMARY KEY (BusinessEntityID, EmailAddressID),\n CONSTRAINT fk_emailaddress_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES Person (BusinessEntityID)\n);\n\nCREATE TABLE SalesTaxRate (\n SalesTaxRateID integer, -- example: [1, 4]\n StateProvinceID integer, -- example: [1, 6]\n TaxType integer, -- example: [1, 2]\n ModifiedDate datetime, -- example: ['2008-04-30 00:00:00.0']\n PRIMARY KEY (SalesTaxRateID),\n CONSTRAINT fk_salestaxrate_stateprovinceid FOREIGN KEY (StateProvinceID) REFERENCES StateProvince (StateProvinceID)\n);\n\nCREATE TABLE CreditCard (\n CreditCardID integer, -- example: [11935, 12094]\n CardNumber text, -- example: ['11111000471254', '11111002034157']\n ExpYear integer, -- Expiration Year, example: [2006, 2005]\n ModifiedDate datetime, -- example: ['2013-07-29 00:00:00.0', '2013-12-05 00:00:00.0']\n PRIMARY KEY (CreditCardID)\n);\n\nCREATE TABLE Document (\n DocumentNode text, -- example: ['/', '/1/']\n DocumentLevel integer, -- example: [0, 1]\n Owner integer, -- example: [217, 219]\n FileExtension text, -- example: ['.doc']\n Status integer, -- example: [2, 1]\n PRIMARY KEY (DocumentNode)\n);\n\nCREATE TABLE TransactionHistoryArchive (\n TransactionID integer, -- example: [1, 2]\n ProductID integer, -- example: [1, 359]\n TransactionType text, -- example: ['P', 'S']\n Quantity integer, -- example: [4, 3]\n PRIMARY KEY (TransactionID)\n);\n\nCREATE TABLE PhoneNumberType (\n PhoneNumberTypeID integer, -- example: [1, 2]\n Name text, -- Phone Number, example: ['Cell', 'Home']\n ModifiedDate datetime, -- example: ['2017-12-13 13:19:22.0']\n PRIMARY KEY (PhoneNumberTypeID)\n);\n\nCREATE TABLE EmployeePayHistory (\n BusinessEntityID integer, -- example: [1, 2]\n RateChangeDate datetime, -- example: ['2009-01-14 00:00:00.0', '2008-01-31 00:00:00.0']\n PayFrequency integer, -- example: [2, 1]\n PRIMARY KEY (BusinessEntityID, RateChangeDate)\n);\n\nCREATE TABLE CurrencyRate (\n CurrencyRateID integer, -- example: [1, 2]\n CurrencyRateDate datetime, -- example: ['2011-05-31 00:00:00.0', '2011-06-01 00:00:00.0']\n FromCurrencyCode text, -- example: ['USD']\n ToCurrencyCode text, -- example: ['ARS', 'AUD']\n EndOfDayRate real, -- example: [1.0002, 1.55]\n PRIMARY KEY (CurrencyRateID)\n);\n\nCREATE TABLE JobCandidate (\n JobCandidateID integer, -- example: [2, 3]\n ModifiedDate datetime, -- example: ['2007-06-23 00:00:00.0', '2013-12-22 18:32:21.0']\n PRIMARY KEY (JobCandidateID)\n);\n\nCREATE TABLE ProductListPriceHistory (\n ProductID integer, -- example: [707, 708]\n StartDate date, -- example: ['2011-05-31 00:00:00.0', '2012-05-30 00:00:00.0']\n EndDate date, -- example: ['2012-05-29 00:00:00.0', '2013-05-29 00:00:00.0']\n ListPrice real, -- example: [33.6442, 34.99]\n PRIMARY KEY (ProductID, StartDate),\n CONSTRAINT fk_productlistpricehistory_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ShoppingCartItem (\n ShoppingCartItemID integer, -- example: [2, 4]\n ShoppingCartID text, -- example: ['14951', '20621']\n Quantity integer, -- example: [3, 4]\n ProductID integer, -- example: [862, 881]\n ModifiedDate datetime, -- example: ['2013-11-09 17:54:07.0']\n PRIMARY KEY (ShoppingCartItemID),\n CONSTRAINT fk_shoppingcartitem_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE BusinessEntity (\n BusinessEntityID integer, -- example: [8722, 4079]\n PRIMARY KEY (BusinessEntityID)\n);\n\nCREATE TABLE PurchaseOrderDetail (\n PurchaseOrderID integer, -- example: [1, 2]\n PurchaseOrderDetailID integer, -- example: [1, 2]\n OrderQty integer, -- Order Quantity, example: [4, 3]\n ProductID integer, -- example: [1, 359]\n PRIMARY KEY (PurchaseOrderDetailID),\n CONSTRAINT fk_purchaseorderdetail_purchaseorderid FOREIGN KEY (PurchaseOrderID) REFERENCES PurchaseOrderHeader (PurchaseOrderID),\n CONSTRAINT fk_purchaseorderdetail_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE Currency (\n CurrencyCode text, -- example: ['ALL', 'AED', 'AFA']\n Name text, -- example: ['Afghani', 'Algerian Dinar']\n PRIMARY KEY (CurrencyCode)\n);\n\nCREATE TABLE Vendor (\n BusinessEntityID integer, -- example: [1596, 1496]\n PRIMARY KEY (BusinessEntityID),\n CONSTRAINT fk_vendor_businessentityid FOREIGN KEY (BusinessEntityID) REFERENCES BusinessEntity (BusinessEntityID)\n);\n\nCREATE TABLE ProductSubcategory (\n ProductSubcategoryID integer, -- example: [2, 3]\n ProductCategoryID integer, -- example: [1, 2]\n Name text, -- example: ['Bib-Shorts', 'Bike Racks']\n PRIMARY KEY (ProductSubcategoryID),\n CONSTRAINT fk_productsubcategory_productcategoryid FOREIGN KEY (ProductCategoryID) REFERENCES ProductCategory (ProductCategoryID)\n);\n\nCREATE TABLE ProductReview (\n ProductReviewID integer, -- example: [1, 2]\n ProductID integer, -- example: [709, 937]\n ReviewDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n ModifiedDate datetime, -- example: ['2013-09-18 00:00:00.0', '2013-11-13 00:00:00.0']\n PRIMARY KEY (ProductReviewID),\n CONSTRAINT fk_productreview_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID)\n);\n\nCREATE TABLE ProductDocument (\n ProductID integer, -- example: [317, 318]\n DocumentNode text, -- example: ['/2/1/', '/3/1/']\n PRIMARY KEY (ProductID, DocumentNode),\n CONSTRAINT fk_productdocument_productid FOREIGN KEY (ProductID) REFERENCES Product (ProductID),\n CONSTRAINT fk_productdocument_documentnode FOREIGN KEY (DocumentNode) REFERENCES Document (DocumentNode)\n);\n\nCREATE TABLE ScrapReason (\n ScrapReasonID integer, -- example: [1, 2]\n Name text, -- example: ['Brake assembly not as ordered', 'Color incorrect']\n PRIMARY KEY (ScrapReasonID)\n);\n\nCREATE TABLE ProductPhoto (\n ProductPhotoID integer, -- example: [69, 70]\n PRIMARY KEY (ProductPhotoID)\n);\nThis schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.\n\nQuestion:\nProfit = MULTIPLY(SUBTRACT(ListPrice, StandardCost) Quantity))\nWhat is the total profit all transactions with product ID 827?\n\nInstructions:\n- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.\n- The generated query should return all of the information asked in the question without any missing or extra information.\n- Before generating the final SQL query, please think through the steps of how to write the query.\n\nOutput Format:\nIn your answer, please enclose the generated SQL query in a code block:\n```sql\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.